Description Usage Arguments Details Value Author(s) References Examples
Fit a 2D circle to an (x,y) dataset using LS.
1 2 3 4 5 6 |
x |
either a matrix with two columns or a vector. |
y |
if |
init |
initial values of the parameters. A vector of length 3 with
the following components: radius of the circle, x-coordinate of the
center, y-coordinate of the center. If |
units |
the |
template |
the |
modulo |
the |
zero |
the |
rotation |
the |
... |
further parameters passed to the |
digits |
the number of digits to be printed. |
lsfit.circle
uses the optim
function to minimize the sum of the
squared residuals between the observations and the optimally fitting circle.
An object of class lsfit.circle
.
coefficients |
a vector of length 3 with the estimated radius and coordinate of the center of the fitted circle. |
x |
the x-coordinate. |
y |
the y-coordinate. |
x.centered |
the x-coordinate re-centered at the center of the circle. |
y.centered |
the y-coordinate re-centered at the center of the circle. |
angles |
angles of the observations with respect to the center
coordinate of class |
radius |
the distance between the observations and the center coordinate |
convergence |
value from the function optim. |
optim |
the output from the function optim. |
call |
the |
Claudio Agostinelli and Ulric Lund
Coope, I. (1993). Circle fitting by linear and non-linear least squares. Journal of Optimization Theory and Applications, 76, 381-388.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(coope)
res <- lsfit.circle(x=x.coope, y=y.coope)
res
plot(res)
par(mfcol=c(1,2))
plot(res$angles)
hist(res$radius)
plot(circular(0), type="n", xlim=c(-5.2, 5.2), ylim=c(-5.2, 5.2),
xlab="The Radius of the circle \n is measured from the base line of the axes.")
lines(x=res$angles, y=res$radius, join=TRUE, type="b")
ff <- function(x) sqrt((res$coefficients[1]*cos(x))^2+(res$coefficients[1]*sin(x))^2)
curve.circular(ff, add=TRUE, join=TRUE, nosort=FALSE, col=2)
windrose(x=res$angles, y=res$radius)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.