File Exchange

image thumbnail


version (7.5 KB) by Martti K
Direct fitting of ellipses, ellipsoids, and hyperellipsoids


Updated 16 Apr 2019

View Version History

View License

The function HYPERELLIPSOIDFIT.M fits a quadratic surface to given n-dimensional data. It has been written especially for ellipsoid fitting purposes. It contains n-dimensional elaborations of several ellipse fitting methods, and includes a method that is guaranteed to produce an ellipsoidal solution in n-dimensional space regardless of the data. It includes also a regularization method that can be used to force the solutions towards spheres and to solve ill-posed fitting problems.
The implemented methods are described in Kesäniemi-Virtanen, "Direct Least Square Fitting of Hyperellipsoids", IEEE Transactions on Pattern Analysis and Machine Intelligence.
The other function in the package, DEMO.M, uses HYPERELLIPSOIDFIT function to illustrate the 3D results produced by various fitting methods with three different regularization parameter values.

Cite As

Martti K (2021). hyperellipsoidfit (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

mingyang zhao

Good! Thanks a lot!

Neil Claussen

Works very well on sparse data sets, thank you!

Martti K

If you need the parameter vector A for unnormalized input data, please use parameter ...' 'normalize', false, ... Otherwise the input data is normalized for improved computational stability, and the normalization is taken into account only for parameters Me and oe.

% Parametric form of the quadric surface fitted to the data or
% normalized data is returned in vector A;

Min Han

why is the parameter vector A incorrect?

Mattia Gollub

Great tool, thank you!

Carl Witthoft

For ease of use and for traceability of output, recommend making the return a single struct, i.e. foo.Me, foo.oe, foo.succcess, etc.

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!