3-D line of best fit from origin to cloud of data points

24 vues (au cours des 30 derniers jours)
Wes Anderson
Wes Anderson le 3 Déc 2019
Commenté : Matt J le 13 Nov 2021
I'm trying to get a line of best fit for a 3-D set of data points. This line of fit should go from the origin to the "cloud" of points, and I'd like to know the equation for that fit. Any ideas?
Thanks

Réponses (1)

Matt J
Matt J le 3 Déc 2019
Modifié(e) : Matt J le 3 Déc 2019
The equation is t*u where u is 3D line direction vector obtained by,
[V,d]=eig(A.'*A,'vector');
[~,i]=max(d);
u=V(:,i);
and A is an Nx3 matrix whose rows are your cloud points.
  6 commentaires
Chang hsiung
Chang hsiung le 13 Nov 2021
wow, thanks a lot Matt !!!
Matt J
Matt J le 13 Nov 2021
@Chang hsiung You're quite welcome. Please accept-click the answer if it helped you.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by