How to find major peak values and the avarage distance between them in a signal?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a signal like this :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149521/image.jpeg)
I want to:
- Find and mark ONLY major positive peak points ( not the small peaks) on graph.
- Find the avarage distance between them (these major positive peak values).
- Find the peaks whose distance between is much different the avarage value.
Can anyone help with finding these values? Thanks in advance!
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 8 月 30 日
%If y is your signal
x=10:0.1:100;
y=100*cos(x)./x;
plot(x,y)
% you have to specify what is the major peak
min_peak=2
[peaks,idx1]=findpeaks(y)
% Major peaks and indices
[major_peaks, index]=find(peaks>=min_peak)
indices=idx1(index)
%distances
distances=mean(diff(indices))
%you can find the maximum distance
3 件のコメント
Image Analyst
2013 年 8 月 30 日
But you've accepted two answers that tell you the same thing and now you're saying neither one works? Like the answer in your duplicate question said you might have to play around with the optional inputs to findpeaks(). Did you try that?
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!