File Exchange

image thumbnail

Sub-Sample Peak Fitting 2D

version (2.07 KB) by

Find sub-sample location of global maximum in a 2-dimensional numerical matrix.

1 Download


View License

This small contribution is useful in cases where you search for the position of a peak within an intensity matrix (correlation or energy fields) of low resolution. Since this is only a 2nd-order-fit the sub-sample accuracy will only be acceptable as long as the peak area is 'smooth' around the peak location. This is not an exact solution, since it does not consider any underlying signal characteristics.

Sample usage: % 2d-gauss: center=19.5; sigma=5

>> M = exp(-((1:30) - 19.5).^2/(2*5^2));
>> P = peakfit2d(M'*M);
>> disp(P);
19.5050 19.5050

Comments and Ratings (3)


Irvin (view profile)

Nice implementation, thanks.


Ketan (view profile)

Works fine, I am also using it in a tracking application.


Mauro (view profile)

thx a lot :-) i use it for track movements on a avi-video

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video