Search This Blog

Finding Local Maxima and Local Minima using fundamental signals | DSP | MATLAB

clc

clear all

close all

t=0:0.01:10*pi;

x=2*sin(t)+0.5*t;

plot(t,x,'r','linewidth',5);

hold on;

gs=diff(x);

ms=sign(gs);

d=diff(ms);

e=find(d<0);

plot(t(e),x(e),'bo','linewidth',5);

hold on;

e=find(d>0);

plot(t(e),x(e),'go','linewidth',5);

legend('Original Input Signal','Local Maxima','Local Minima');




No comments