I have a dataset of 3D points, which are arranged in clusters resembling a (semi-)ellipsoidal shape. When I try standard ellipsoid fitting as, e.g. implemented in the MATLAB function http://www.mathworks.com/matlabcentral/fileexchange/24693-ellipsoid-fit , I get imaginary radii, no matter if I apply the fitting to all points within the ellipsoidic volume or only to points sitting on its convex hull.
I wonder whether the fact that the cluster shape is more semi-ellipsoidal than resembling a full ellipsoid leads to these instabilities? Is there any more robust method that could solve my problem?
UPDATE:
This is an example for one such cluster of 3D points. The blue circles indicated points located on the convex hull of the cluster.
The minimal working example for the convex hull case would be as follows:
k = convhull(x, y, z);
ind = unique(k(:));
[center,radii,evecs,~] = ellipsoid_fit([x(ind),y(ind),z(ind)], 1);