How to find the latest peak value of a curve.

16 views (last 30 days)
I have a problem, i want to find the latest peak value of the following power curve. It is not the maximum power point, i've already found it earlier. But i should compare the latest value P(end) with P(end-1) and if P(end)<P(end-1) we should continue like this... to reach the point where P(i)>P(i-1) to come one value before, it will give me the latest peak power value.
Thank's for your help ;) Jb
jiro on 13 Dec 2016
findpeaks takes a numeric vector as the input. That's what the error "Expected Y to be numeric" means.

Sign in to comment.

Accepted Answer

jiro on 13 Dec 2016
[pk,loc] = findpeaks(P(end:-1:1),'NPeaks',1);
[U(end-loc+1) pk]

More Answers (1)

Adam on 13 Dec 2016
If you have the Signal Processing Toolbox just use findpeaks, if not since you only want the last peak even a simple loop running from the end of the trace forward and stopping when you reach a point where you stop increasing would do the job.
  1 Comment
Jean-Baptiste DUCAT
Jean-Baptiste DUCAT on 13 Dec 2016
I've already done that but it's ok i've the right answer now thank's for all ;)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!