Timeseries data convergence test

18 vues (au cours des 30 derniers jours)
Kommineni chandra sekhar
Kommineni chandra sekhar le 16 Mai 2022
Réponse apportée : Arjun le 8 Nov 2024 à 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 commentaires
Mathieu NOE
Mathieu NOE le 17 Mai 2022
hello
have data ?
have started a code ?
Kommineni chandra sekhar
Kommineni chandra sekhar le 17 Mai 2022
Hello,
I'm using cumsum function, assume data is random function(can't share).
But I would like to code above mentioned, I haven't figure it out.

Connectez-vous pour commenter.

Réponses (1)

Arjun
Arjun le 8 Nov 2024 à 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:
I hope this helps!

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by