Least Squares Method for best line fitting

2 ビュー (過去 30 日間)
Tharindu Weerakoon
Tharindu Weerakoon 2015 年 2 月 26 日
コメント済み: Tharindu Weerakoon 2015 年 2 月 27 日
I have a set of X and Y coordinates data taken from Laser scanning
X=[x1 x2 x3 x4 .....] Y=[y1 y2 y3 y4 .....]
Elements of both the X and Y include some errors.
I tried to find the best fitting line using polyfit and polyval command in matlab, but it can use only to calculate the Yhat w.r.t. X data.
At the end it will give X and Yhat only.
If I want to know calculate both the Xhat and Yhat, how can I use polyfit and polyval ?

採用された回答

Torsten
Torsten 2015 年 2 月 26 日
I think you are talking about "orthogonal linear regression".
Try
Polyfit is not suited for this kind of Fitting ; it assumes there are no errors in the independent variable.
Best wishes
Torsten.
  1 件のコメント
Tharindu Weerakoon
Tharindu Weerakoon 2015 年 2 月 27 日
Yes Torsten. Thanks a lot.
Still the problem is how to compute the Xhat and Yhat from x and y dataset with errors.
Initially I have a data set from LRF (laser scanner): [theta, d] from this data det I compute the x and y.
[theta, d] ---> [d*cos(theta) d*sin(theta)]=[x, y]
It is difficult to use [theta, d], which d is having error only. Because no constrain to use.
So [x y] only be used for segment the data and Orthogonal linear regression to find the best fitted line.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by