From: E W on 5 Aug 2010 07:25 I am trying to find all local maxima of an n-dimensional function (which is numerically in the form of a matrix). Does anyone know of a fast method for this? Thanks in advance.
From: Bruno Luong on 5 Aug 2010 07:42 "E W" <donotsent(a)donotsend.de> wrote in message <i3e72l$mn3$1(a)fred.mathworks.com>... > I am trying to find all local maxima of an n-dimensional function (which is numerically in the form of a matrix). Does anyone know of a fast method for this? Thanks in advance. You can use my FEX submission http://www.mathworks.com/matlabcentral/fileexchange/24705-minmax-filter % Data, 2d here but should work for nd as well >> A = peaks; % Return linear index of the local minima >> find(A==minmaxfilt(A,3,'min','same')) ans = 1 49 664 1286 1302 2401 % Bruno
From: Alan Weiss on 5 Aug 2010 07:47 On 8/5/2010 7:25 AM, E W wrote: > I am trying to find all local maxima of an n-dimensional function (which > is numerically in the form of a matrix). Does anyone know of a fast > method for this? Thanks in advance. I am not sure what you mean "which is numerically in the form of a matrix." Is your function a real-valued function of an n-dimensional point? Or is it a matrix-valued function? If it is matrix-valued, what does local maximum mean? If your function is real-valued, then perhaps you can use MultiStart from the Global Optimization Toolbox, with a regular or perturbed array of initial values: http://www.mathworks.com/access/helpdesk/help/toolbox/gads/bsc5_cj.html#bseat0r For an example: http://www.mathworks.com/access/helpdesk/help/toolbox/gads/bsc9noc.html#bseyhh5 Of course, to get local maxima instead of minima, take the negative of your objective function: http://www.mathworks.com/access/helpdesk/help/toolbox/gads/brdvu8r.html#brdvvgw Alan Weiss MATLAB mathematical toolbox documentation
From: ImageAnalyst on 5 Aug 2010 09:43 If you have the Image Processing Toolbox, use imregionalmax: http://www.mathworks.com/access/helpdesk/help/toolbox/images/imregionalmax.html
|
Pages: 1 Prev: Simulink change scope background color Next: generate correlation matrix |