How to find valley amplitude position of individual signals?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
krishna kireeti
el 21 de Abr. de 2017
Comentada: Star Strider
el 22 de Abr. de 2017
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163184/image.png)
0 comentarios
Respuesta aceptada
Star Strider
el 21 de Abr. de 2017
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 comentarios
Star Strider
el 22 de Abr. de 2017
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.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!