Publisher review:local maxima minima - a simple (but effective) code to find local maximas This is a very simple function to find the local maximum in any dimensional array. As simple as it is it still gives nice results.I use the imdilate() function as a maximum operation and then compare the data to the result.The function receives two parameters:the data and a vector defining the minimum distance between peaks in each of the data dimensions.use examples:a = cumsum(randn(1000,1));peaks = localMaximum(a,[100]);figure; plot(a); hold on; plot(peaks,a(peaks),'ro');[x y] = meshgrid(-6:0.1:6,-6:0.1:6);a = sinc(x).*sinc(y);lMaxInd = localmaximum(a,[20 20]);lMinInd = localMaximum(-a,[20 20]);figure; mesh(x,y,a); hold on;plot3(x(lMaxInd),y(lMaxInd),a(lMaxInd),'k*','markersize',10,'linewidth',1.5);plot3(x(lMinInd),y(lMinInd),a(lMinInd),'g*','markersize',10','linewidth',1.5);legend('sinc(x)sinc(y)','peaks','valleys','location','best') Requirements: · MATLAB Release: R14SP2 · Image Processing Toolbox
local maxima minima is a Matlab script for Signal Processing scripts design by Yonathan Nativ.
It runs on following operating system: Windows / Linux / Mac OS / BSD / Solaris.
Operating system:Windows / Linux / Mac OS / BSD / Solaris