MATLAB Answers

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

11 views (last 30 days)
Wes Anderson
Wes Anderson on 3 Dec 2019
Edited: Matt J on 4 Dec 2019
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?


Sign in to comment.

Answers (1)

Matt J
Matt J on 3 Dec 2019
Edited: Matt J on 3 Dec 2019
The equation is t*u where u is 3D line direction vector obtained by,
and A is an Nx3 matrix whose rows are your cloud points.


Show 1 older comment
Matt J
Matt J on 4 Dec 2019
t is an arbitrary scalar. For different choices of t, you get different points along the line.
Wes Anderson
Wes Anderson on 4 Dec 2019
Thank you for replying. So, for new data, when I want to use this transformation/line fit, where do I plug the new data in? Or is that not how this works...I'm sorry if that is a dumb question.
Thank you again
Matt J
Matt J on 4 Dec 2019
Not sure what you mean by "new data" nor what you mean by "use this transformation". You haven't described what you plan to do with the line fit once you have it. But what I can say is, the steps I showed do indentify the best fit line and give you a way to calculate different points along the line (by evaluating t*u for different t).

Sign in to comment.

Sign in to answer this question.