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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by