Timeseries data convergence test
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kommineni chandra sekhar
el 16 de Mayo de 2022
Respondida: Arjun
el 8 de Nov. de 2024 a las 8:40
Hello Sir/Madam,
I'm trying to do convergence test for measurement data(Velocity) that we got from laboratory. I measured for 300 sec with sampling frequency of 200 Hz that means I have 60000,so I have array of 60000x1 . I'm trying to do convergence test for mean,rms, of velocity, I want to plot mean vs set of bins.
I want to start with first 1000 points average, then first 2000 points, then 3000 points...like continue till overall mean.
I checked online, I found cumsum function, but Cumsum function calculates every other element.
Can someone guide me how to proceed with this problem?
Thank you so much for your help in advance,
2 comentarios
Respuestas (1)
Arjun
el 8 de Nov. de 2024 a las 8:40
I see that you have some velocity data and you want to find the running mean and rms values.
To do so you can use a “for” loop which will run from 1 to the number of bins. In each iteration of the “for” loop you can extract the current accumulated data then find mean and rms values and store them in respective arrays for visualization later.
Kindly refer to the code below for better understanding:
% Assume velocityData is your 60000x1 data array
velocityData = randn(60000, 1);
maxPoints = length(velocityData);
increment = 1000;
% Preallocate arrays to store mean and RMS values
means = zeros(maxPoints/increment, 1);
rmsValues = zeros(maxPoints/increment, 1);
bins = increment:increment:maxPoints;
% Calculate mean and RMS for each bin
for i = 1:length(bins)
currentData = velocityData(1:bins(i));
means(i) = mean(currentData);
rmsValues(i) = rms(currentData);
end
% Plot the mean convergence
figure;
subplot(2, 1, 1);
plot(bins, means, '-o');
xlabel('Number of Data Points');
ylabel('Mean Velocity');
title('Convergence of Mean Velocity');
% Plot the RMS convergence
subplot(2, 1, 2);
plot(bins, rmsValues, '-o');
xlabel('Number of Data Points');
ylabel('RMS Velocity');
title('Convergence of RMS Velocity');
Kindly refer to the documentation of “mean” and “rms” function:
- mean: https://www.mathworks.com/help/releases/R2022a/matlab/ref/mean.html
- rms: https://www.mathworks.com/help/releases/R2022a/matlab/ref/rms.html
I hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!