Timeseries data convergence test

16 ビュー (過去 30 日間)
Kommineni chandra sekhar
Kommineni chandra sekhar 2022 年 5 月 16 日
回答済み: Arjun 2024 年 11 月 8 日 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 件のコメント
Mathieu NOE
Mathieu NOE 2022 年 5 月 17 日
hello
have data ?
have started a code ?
Kommineni chandra sekhar
Kommineni chandra sekhar 2022 年 5 月 17 日
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.

サインインしてコメントする。

回答 (1 件)

Arjun
Arjun 2024 年 11 月 8 日 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!

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by