How to find the latest peak value of a curve.

2 visualizaciones (últimos 30 días)
Jean-Baptiste DUCAT
Jean-Baptiste DUCAT el 13 de Dic. de 2016
Comentada: Jean-Baptiste DUCAT el 13 de Dic. de 2016
Hello,
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
  2 comentarios
Jean-Baptiste DUCAT
Jean-Baptiste DUCAT el 13 de Dic. de 2016
I've tried with findpeak function but it return me an error message:
>> PV=plot(U,P)
PV =
Line with properties:
Color: [0 0.4470 0.7410]
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerSize: 6
MarkerFaceColor: 'none'
XData: [1x262 double]
YData: [1x262 double]
ZData: [1x0 double]
Show all properties
>> findpeaks(PV)
Error using findpeaks
Expected Y to be one of these types:
numeric
Instead its type was matlab.graphics.chart.primitive.Line.
Error in findpeaks>parse_inputs (line 191)
validateattributes(Yin,{'numeric'},{'nonempty','real','vector'},...
Error in findpeaks (line 134)
= parse_inputs(Yin,varargin{:});
Jiro Doke
Jiro Doke el 13 de Dic. de 2016
findpeaks takes a numeric vector as the input. That's what the error "Expected Y to be numeric" means.

Iniciar sesión para comentar.

Respuesta aceptada

Jiro Doke
Jiro Doke el 13 de Dic. de 2016
[pk,loc] = findpeaks(P(end:-1:1),'NPeaks',1);
[U(end-loc+1) pk]

Más respuestas (1)

Adam
Adam el 13 de Dic. de 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 comentario
Jean-Baptiste DUCAT
Jean-Baptiste DUCAT el 13 de Dic. de 2016
I've already done that but it's ok i've the right answer now thank's for all ;)

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by