How to find out distance among peaks from a plot?

조회 수: 79 (최근 30일)
Zara Khan
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
Adam 2018년 7월 5일
doc findpeaks
if you have the Signal Processing toolbox
Zara Khan
Zara Khan 2018년 7월 5일
Yes. But distance I am not able to find

댓글을 달려면 로그인하십시오.

답변 (2개)

Wooshik Kim
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
Zara Khan 2018년 7월 6일
편집: 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
Adam 2018년 7월 6일

댓글을 달려면 로그인하십시오.


Rahul punk
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))

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by