MATLAB Answers

0

How to find out distance among peaks from a plot?

Zara Khan さんによって質問されました 2018 年 7 月 5 日
最新アクティビティ Rahul punk さんによって 回答されました 2019 年 3 月 15 日
some binary intensity values have stored in a profile and has been plotted. And getting some peaks from it. Here plot function has been used. How to find out distance among the peaks?

  2 件のコメント

Adam
2018 年 7 月 5 日
doc findpeaks
if you have the Signal Processing toolbox
Zara Khan 2018 年 7 月 5 日
Yes. But distance I am not able to find

サインイン to comment.

2 件の回答

回答者: Wooshik Kim 2018 年 7 月 5 日

findpeaks gives you location of the peak as well
[pks,locs] = findpeaks(PeakSig,x);
dist = locs(2) - locs(1); %or whichever two peaks you want to know about

  2 件のコメント

Zara Khan 2018 年 7 月 6 日
For different different graphs I am getting different different peaks. after counting no of peaks I want to find out distance between each of them means distance between first and second, between second and third and so on. How to do that ?
Adam
2018 年 7 月 6 日
diff( locs )

サインイン to comment.


回答者: Rahul punk 2019 年 3 月 15 日

%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))

  0 件のコメント

サインイン to comment.



Translated by