second largest peak value
42 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ramesh Bala
el 12 de Jun. de 2019
Comentada: Ramesh Bala
el 6 de Ag. de 2019
I'm getting the amp of second largest peak as correct but the time is wrong ?
How to obtain the second highest value X,Y from this and plot as already Y is correct ,X seems to be in wrong region?
s=load ('30827.mat');
signal(1,1:length(s.ans))=s.ans;
load t.mat;
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t);
[highestPeak, indexOfHighestPeak] = max(PkAmp);
[a(1),b2]=max(abs(hilbert(signal(1,:))));
[a2(1),b6]=max(PkAmp(PkAmp<max(PkAmp))); % to get second largest peak value
% error is the time value calcluate and plotted wrong??
Highesttime(1,:) = t(b2);
Highest2time(1,:) = t(b6);
figure;
plot(t,(signal(1,:)),t,abs(hilbert(signal(1,:))),t(b2),a(1),'ro')
hold on
plot(PkTime, PkAmp, '^r', 'MarkerFaceColor','r')
xlim([0 0.0006]);ylim([-inf inf])
grid on
hold on,plot(t(b6),a2(1),'ko')
hold off
0 comentarios
Respuesta aceptada
Alex Mcaulley
el 12 de Jun. de 2019
To obtain the coordinates of the second peak you just need:
[PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t);
[~,idx] = sort(PkAmp,'descend');
PkAmp(idx(2)) %Amplitude of the second peak
PkTime(idx(2)) %Time of the second peak
13 comentarios
Más respuestas (1)
Steven Lord
el 13 de Jun. de 2019
Use the islocalmax function with the 'MaxNumExtrema' option.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!