Runs on all platforms: Windows, Linux, Mac OS
-->ellipfit
function [Xc, Yc, a, b, g] = ellipfit(Xp, Yp, Po)
ellipfit: Looks for the best circle or ellipse fitting some given 2D data
points
CALLING SEQUENCES:
ellipfit // Displays this help
ellipfit circle // Runs a randomized circle-fitting demo.
ellipfit ellipse // Runs a randomized ellipse-fitting demo.
[xc, yc, r] = ellipfit(Xp, Yp [,Po]) // fits data with a circle
[xc, yc, a, b] = ellipfit(Xp, Yp [,Po]) // fits data with a right ellipse
[xc, yc, a, b, g] = ellipfit(Xp, Yp [,Po]) // fits data with a tilted ellipse
PARAMETERS:
Xp: Row or column of abscissae of data points
Yp: Row or column or ordinates of data points (same length than Xp)
xc, yc: Coordinates of the center of the best fitting circle | ellipse
r: Radius of the best fitting circle
a: Horizontal radius of the best fitting ellipse
b: Vertical radius of the best fitting ellipse
g: Tilt angle, on [0, 90]°
Po: Optional explicit vector of initial parameters (best guess).
It may have from 1 to 5 elements, in this order:
[xc0 yc0 r0] or [xc0 yc0 a0 b0 g0]
The number of expected output parameters chooses the fitting type.
CHANGES 1.0 => 2.0
------------------
- Tilted ellipses can now be fitted.
- The type of fitting is now set by the number of expected output parameters.
- Initial parameters: Automatic first guess improved a lot.
- Constrains on parameters added (automatic guess).
- Demo improved and updated