www.gusucode.com > signal 案例源码程序 matlab代码 > signal/FindPeaksInAVectorExample.m
%% Find Peaks in a Vector % Define a vector with three peaks and plot it. % Copyright 2015 The MathWorks, Inc. data = [25 8 15 5 6 10 10 3 1 20 7]; plot(data) %% % Find the local maxima. The peaks are output in order of occurrence. The % first sample is not included despite being the maximum. For the flat % peak, the function returns only the point with lowest index. pks = findpeaks(data) %% % Use |findpeaks| without output arguments to display the peaks. findpeaks(data)