www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/DetermineTheLocalMaximaAndMinimaExample.m
%% Determine the local Maxima and Minima %% % *Note*: This example runs only in R2016b or later. If you are using an % earlier release, replace each call to the function with the equivalent % |step| syntax. For example, myObject(x) becomes step(myObject,x). %% % Determine whether each value of an input signal is local maximum or % minimum. hpeaks1 = dsp.PeakFinder; hpeaks1.PeakIndicesOutputPort = true; hpeaks1.PeakValuesOutputPort = true; x1 = [9 6 10 3 4 5 0 12]'; %% % Find the peaks of each input [prev;cur;next]: {[9;6;10],[6;10;3],...} [cnt1, idx1, val1, pol1] = hpeaks1(x1)