How to find major peak values and the avarage distance between them in a signal?

조회 수: 2 (최근 30일)
I have a signal like this :
I want to:
  1. Find and mark ONLY major positive peak points ( not the small peaks) on graph.
  2. Find the avarage distance between them (these major positive peak values).
  3. Find the peaks whose distance between is much different the avarage value.
Can anyone help with finding these values? Thanks in advance!

채택된 답변

Azzi Abdelmalek
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
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?
Ekin
Ekin 2013년 8월 30일
Yeah tried them; when i accepted my duplicate question, i wanted to mark only peak points and that link in answer solved my problem, so i accepted it.
In this question i had 3 more questions and all solved now, so accepted this one too ^^

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by