How to solve polyfit(x,y,1) by hand?
9 ビュー (過去 30 日間)
古いコメントを表示
Hello so I know how to find polyfit using matlab but how do I find it without matlab? I need to know how to do it for linear equations like polyfit(x,y,1) can we assume that x=[1 2] and y=[3 4] and thanks alot I appreciate the help
0 件のコメント
回答 (2 件)
John D'Errico
2018 年 4 月 25 日
To solve it without MATLAB, just read ANY of hundreds of books or websites about linear regression modeling.
Start here:
https://en.wikipedia.org/wiki/Linear_regression
3 件のコメント
Guillaume
2018 年 4 月 25 日
I tried that but couldn't find anything
You're kidding, right? There are zillions of books dedicated to linear regressions. The wikipedia article that John linked also explains it all.
In addition you can even look at the code of polyfit and see for yourself exactly how it does it.
Torsten
2018 年 4 月 25 日
If you only have two points for a polynomial of degree 1, you have to solve a linear system of two equations:
3 = a*1 + b
4 = a*2 + b
for a and b.
The equation of the line is then given by
y = a*x + b
Best wishes
Torsten.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!