load sampleletters.mat
plot(m1.Time,m1.X)
idxmin=islocalmin(m1.X)//找出局部最小值
idxmax=islocalmax(m1.X)plot(m1.Time,m1.X)
hold on
plot(m1.Time(idxmin),m1.X(idxmin),"o")plot(m1.Time(idxmax),m1.X(idxmax),"s")
hold off
[idx,prom]=islocalmin(m1.X)plot(m1.Time,prom)
idxmin=islocalmin(m1.X,"MinProminence",0.1)//找出的局部最小值加了限制,比左右两个值要小0.1以上
idxmax=islocalmax(m1.X,"MinProminence",0.1)plot(m1.Time,m1.X)
hold on
plot(m1.Time(idxmin),m1.X(idxmin),"o")plot(m1.Time(idxmax),m1.X(idxmax),"s")
hold off