Nice code, however, you probably have a bug related to the orientation of the ellipse, see:
http://www.mathworks.com/matlabcentral/fileexchange/22423
I fixed it and added a computation of the residual of the fit which provides a quality measure for the fit.
If you want my version, please mail to:
amitruf@gmail.com
Comment only