How to find valley amplitude position of individual signals?

조회 수: 3 (최근 30일)
krishna kireeti
krishna kireeti 2017년 4월 21일
댓글: Star Strider 2017년 4월 22일
hey guys, In the given picture(consider only the upper subplot), is it possible to find the position of maximum negative peak for every signal out there? please help me asap!

채택된 답변

Star Strider
Star Strider 2017년 4월 21일
I would use the findpeaks function on the negative of each signal. So the negative peaks would be:
[pks,locidx] = findpeaks(-signal); % Peaks & Peak Indices In Vector
pks = -pks; % Correct Amplitudes Of Peaks
  댓글 수: 2
krishna kireeti
krishna kireeti 2017년 4월 22일
don't we any other method for this, because I need to plot the peaks(positive and negative peaks in a graph) if we do like this we cannot plot both the peaks at the same time.
Star Strider
Star Strider 2017년 4월 22일
Yes, you can plot both peaks at the same time. You need two different calls to findpeaks, one to find the positive peaks (the ‘usual’ way), and one to find the negative peaks (negating the argument first, then negating the result). Then, use the hold command to do the plotting.
Example
[pos_pks,pos_loc] = findpeaks(signal,x);
[neg_pks,neg_loc] = findpeaks(-signal,x);
figure(1)
plot(x, signal, '-b')
hold on
plot(pos_loc, pos_pks, '^r')
plot(neg_loc, -neg_pks, 'vg')
hold off
grid
legend('Data', 'Peaks', 'Valleys')
NOTE This is UNTESTED CODE. It should work.

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

추가 답변 (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