Line that most closely passes through a set of points?

Started by
1 comment, last by FearedPixel 20 years, 5 months ago
I have a set of points in the order that they should form the line, but they do not perfectly lie on the line. How would I get the equation of the line that most closely lies on the points? Help would be much appreciated. Edit: Actually all I need is the gradient. What im gonna do now is get the gradient of each segment between the points, and average their gradient. If anyone knows of a better solution, please say. [edited by - FearedPixel on November 16, 2003 1:00:26 PM]
Advertisement
I believe the method of least squares is what is normally used.

http://mathworld.wolfram.com/LeastSquaresFitting.html
http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=least+squares&btnG=Google+Search
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
do a google on ''least squares''

This topic is closed to new replies.

Advertisement