필터 지우기
필터 지우기

How to use lsqlin for best line or ploynormial fitting?

조회 수: 3 (최근 30일)
Tharindu Weerakoon
Tharindu Weerakoon 2015년 3월 2일
댓글: Tharindu Weerakoon 2015년 3월 3일
I have a set of X and Y data only.
X=[-11 -10 -9 -8 -6 -4 -2 0 1 2 ] Y=[ 3 5 1 4 6 10 12 12 12.5 12]
I want to calculate the best fitting line for the given set of coordinates. How can I use lsqlin to compute the parameters of the equation.
How can I use it for polynomials?

답변 (1개)

Torsten
Torsten 2015년 3월 2일
Is there any advantage of lsqlin over polyfit you have in mind ?
Best wishes
Torsten.
  댓글 수: 1
Tharindu Weerakoon
Tharindu Weerakoon 2015년 3월 3일
I'm not sure about the advantages of lsqlin. But indeed ployfit can be used with independent variable X to calculate the Yhat for best fitting as far as I know.
If both X and Y are dependent Orthogonal linear regression will give the best solution over the polyfit (for line fitting only I think).
For nonlinear case, to have the best polynomial for given dependent set of X and Y polyfit will give a much easy solution but I don't have any idea about polynomial fitting technique other than fit command.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by