Fit an ellipse
Syntax: |
ELLIPSE\FIT xin yin
ELLIPSE\FIT\NPTS xin yin n
ELLIPSE\FIT\FRACTION xin yin frac
ELLIPSE\FIT\FRACTION\NPTS xin yin frac n
ELLIPSE\FIT\XYOUT xin yin xout yout
ELLIPSE\FIT\XYOUT\NPTS xin yin n xout yout
ELLIPSE\FIT\XYOUT\FRACTION xin yin frac xout yout
ELLIPSE\FIT\XYOUT\FRACTION\NPTS xin yin frac n xout yout
ELLIPSE\FIT\PARAMETERS xin yin a b xc yc angle
ELLIPSE\FIT\PARAMETERS\NPTS xin yin a b xc yc angle n
ELLIPSE\FIT\PARAMETERS\FRACTION xin yin frac a b xc yc angle
ELLIPSE\FIT\PARAMETERS\FRACTION\NPTS xin yin frac a b xc yc angle n
ELLIPSE\FIT\PARAMETERS\XYOUT xin yin a b xc yc angle xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\NPTS xin yin a b xc yc angle n xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\FRACTION xin yin frac a b xc yc angle xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\FRACTION\NPTS xin yin frac a b xc yc angle n xout yout
|
If the \FIT
qualifier is used, then the
first two parameters, xin
and yin
, are assumed to be
vectors which contain data points to which an ellipse is to be fitted.
Parameter order
The order in which the qualifiers appear is irrelevant. The order in which the
command parameters appear is fixed:
{ fraction } { a b xc yc angle } { npts } { xout yout }
Method
The major axis radius and the centre are found by least squares fitting a line
through the data points. The ratio of the major axis radius to the minor axis
radius is found by computing the standard deviations about the major and minor
axes. The minimum value of the major axis is found for each point so that the
point will be inside the ellipse, then a value for the major axis is picked so
as to be greater than or equal to the specified fraction of the values.
Fraction of points within ellipse
Syntax: |
ELLIPSE\FIT\FRACTION xin yin frac
ELLIPSE\FIT\FRACTION\NPTS xin yin frac n
ELLIPSE\FIT\XYOUT\FRACTION xin yin frac xout yout
ELLIPSE\FIT\XYOUT\FRACTION\NPTS xin yin frac n xout yout
ELLIPSE\FIT\PARAMETERS\FRACTION xin yin frac a b xc yc angle
ELLIPSE\FIT\PARAMETERS\FRACTION\NPTS xin yin frac a b xc yc angle n
ELLIPSE\FIT\PARAMETERS\XYOUT\FRAC xin yin frac a b xc yc angle xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\FRAC\NPTS xin yin frac a b xc yc angle n xout yout
|
frac
defaults to 0.9
, so,
by default, the ellipse is fit to the data points so that it encloses 90% of
the data points. If the \FRACTION
qualifier is used, then a scalar, frac
,
representing the fraction of data points to be within the ellipse will be
expected, 0 < frac < 1.
Output parameters
Syntax: |
ELLIPSE\FIT\PARAMETERS xin yin a b xc yc angle
ELLIPSE\FIT\PARAMETERS\NPTS xin yin a b xc yc angle n
ELLIPSE\FIT\PARAMETERS\FRACTION xin yin frac a b xc yc angle
ELLIPSE\FIT\PARAMETERS\FRACTION\NPTS xin yin frac a b xc yc angle n
ELLIPSE\FIT\PARAMETERS\XYOUT xin yin a b xc yc angle xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\NPTS xin yin a b xc yc angle n xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\FRACTION xin yin frac a b xc yc angle xout yout
ELLIPSE\FIT\PARAMETERS\XYOUT\FRACTION\NPTS xin yin frac a b xc yc angle n xout yout
|
If the \PARAMETERS
qualifier is used,
output scalar names will be expected to receive the resulting ellipse
parameters:
a | major axis radius |
b | minor axis radius |
cx , cy |
x and y coordinates of the centre |
angle | angle of the major axis,
in degrees, measured counter-clockwise from the horizontal |
Ellipse explicitly defined