3-D line of best fit from origin to cloud of data points
44 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Matt J
2019-12-3
编辑:Matt J
2019-12-3
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 个评论
Matt J
2021-11-13
@Chang hsiung You're quite welcome. Please accept-click the answer if it helped you.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!