How to catch first 10 peaks out of 17 peaks of a time series data without reducing time series data?
2 ビュー (過去 30 日間)
古いコメントを表示
I have 100 time series data. I want to find average peak to peak interval. But the intervals are not same in all 100 time series data. Intervals vary from 14 to 18 in some of data. So I am thinking to take first 10 peak intervals in all cases and find their average. Anybody please help.
0 件のコメント
回答 (1 件)
Image Analyst
2021 年 5 月 21 日
Unfortunately you forgot to attach your data.
I'd use findpeaks(). For one signal of y vs. t ....
[peakValues, indexesOfPeaks] = findpeaks(y);
plot(t, y, 'b-', 'LineWidth', 2);
grid on;
hold on;
plot(t(indexesOfPeaks), peakValues, 'r^', 'LineWidth', 2, 'MarkerSize', 14);
% Find first 10 peak spacings
peakSpacings = diff(t(indexesOfPeaks));
lastIndex = max([10, length(peakSpacings)]);
meanPeakSpacing = mean(peakSpacings(1:lastIndex))
fprintf('The average spacing between the first %d peaks is %f.\n', lastIndex, meanPeakSpacing);
Repeat for your other 99 signals.
2 件のコメント
Image Analyst
2021 年 5 月 21 日
So did my code work with it? You forgot to say. I assume you tried it, right? If not, why not?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!