How to mark the peak with Matlab? -


how can use plot function mark peak?

example:

a = [0 1 3 23 3 9 10 28 2] [p,locs] = findpeaks(a) 

result:

p =  23 28   locs =  4 8  

you dont provide x range create 1 (you can change want).

 figure  x = [1:length(a)];  plot(x,a,'k'); 

the above plots original data points following will

 hold on  plot(locs,p,'ro'); 

plot peaks red circle points on top of original series. if need non-integer x-range need calculate appropriate values correspond indices in locs array , use x values instead.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -