function [varargout]=ellipsefit(x,y) %ELLIPSEFIT Stable Direct Least Squares Ellipse Fit to Data. % [Xc,Yc,A,B,Phi,P]=ELLIPSEFIT(X,Y) finds the least squares ellipse that % best fits the data in X and Y. X and Y must have at least 5 data points. % Xc and Yc are the x- and y-axis center of the ellipse respectively. % A and B are the major and minor axis of the ellipse respectively. % Phi is the radian angle of the major axis with respect to the x-axis. % P is a vector containing the general conic parameters of the ellipse.