필터 지우기
필터 지우기

how to find location of right peaks?

조회 수: 3 (최근 30일)
prianka shukla
prianka shukla 2016년 3월 21일
답변: Star Strider 2016년 3월 21일
hello,i have a signal and wanted to find location of peaks and the right peaks.
time=y16;
signal=y15;
%convert to analog
Signal=(5*signal/1023);%anole removing DC offset
indexmin=find(min(Signal)== Signal)
xmin=time(indexmin)
ymin=Signal(indexmin)
indexmax=find(max(Signal)== Signal)
xmax=time(indexmax)
ymax=Signal(indexmax)
plot(time, Signal)
SSignal=smooth(Signal, 40);% smooth signal to find peaks
pks=findpeaks(SSignal)
size(pks)
hold on
plot(time, SSignal,'o')

채택된 답변

Star Strider
Star Strider 2016년 3월 21일
Use findpeaks with two outputs:
[pks,locs] = findpeaks(SSignal);
The ‘locs’ variable will have the index values of the peaks it returns in the ‘pks’ variable.
To plot them, use ‘locs’ as a subscript in the vectors in your second plot call:
plot(time(locs), SSignal(locs),'o')

추가 답변 (0개)

카테고리

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