フィルターのクリア

How to fit largest ellipsoid for 3d data points such that it covers all points?

10 ビュー (過去 30 日間)
ankit agrawal
ankit agrawal 2017 年 8 月 7 日
コメント済み: ankit agrawal 2017 年 8 月 8 日
Hi, I have search a lot for ellipsoid fit to 3d data and come up with some answer but I want some improvement in my method such that it covers all the data points. My code is here.
Y=data; % data in non-principle coordinate
X = data;
oldmu =mean(X);
X= bsxfun(@minus,X,oldmu); % mean-centered data
[pc val] = eig(X'*X );
nC = X*pc; % data in principle coordinate
a2=(max(nC(:,1))-min(nC(:,1)))/2; %range of data in X
b2=(max(nC(:,2))-min(nC(:,2)))/2; %range of data in Y
c2=(max(nC(:,3))-min(nC(:,3)))/2; %range of data in Z
[x, y, z] = ellipsoid(0,0,0,a2,b2,c2,40);
% fit ellipsoid in principle coordinate
tt=[x(:) y(:) z(:)]*inv(pc);%ellipsoid in non-principle coordinate
nx=reshape(tt(:,1),size(x,1),size(x,2));
ny=reshape(tt(:,2),size(x,1),size(x,2));
nz=reshape(tt(:,3),size(x,1),size(x,2));
% plot ellipsoid in non-principle coordinate
hSurface=surf(nx+oldmu(1), ny+oldmu(2), nz+oldmu(3), 'FaceColor','r','EdgeColor','none','FaceAlpha',0.6);
hold on
%plot data in non-principle coordinate
plot3(Y(:,1),Y(:,2),Y(:,3),'k.-')
end
The data file is here.
  1 件のコメント
Baptiste Ottino
Baptiste Ottino 2017 年 8 月 7 日
What do you mean by "covers all the data points". Do you want an ellipsoid that encompasses all the data points? Or is all your data located on the surface of an ellipsoid for sure?

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2017 年 8 月 8 日
I think it's pretty difficult. John did the same thing in 2-D here http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects If it were easy he'd probably have done it already.
  1 件のコメント
ankit agrawal
ankit agrawal 2017 年 8 月 8 日
Thank you for answer. Someone told me about Khachiyan Algorithm and it is working very fine. https://github.com/minillinim/ellipsoid/blob/master/ellipsoid.py

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by