Minimizing least squares regression?

7 ビュー (過去 30 日間)
Brady Retzlaff
Brady Retzlaff 2015 年 11 月 3 日
回答済み: Torsten 2015 年 11 月 4 日
Consider fitting the data {(1, 4),(3, 5),(5, −2)} with the curve f(x) = c1x+c2 so that f(x) minimizes the least squares error This task can also be expressed in A*x = ~b form, where x = [c1, c2] Find A.
I don't need to use matlab to do this one... but i still dont understand how to find A...

回答 (2 件)

Star Strider
Star Strider 2015 年 11 月 3 日
The generic representation A*x = b may seem a bit confusing. You create ‘A’ from the independent variable, and estimate parameter vector ‘x’ from ‘A’ and ‘b’, the dependent variable. The documentation for mldivide,\ goes into detail on the solution to this and the algorithms it uses, so I’ll spare you my description.

Torsten
Torsten 2015 年 11 月 4 日
The function to be minimized is
F(c1,c2) = (c1*1+c2-4)^2 + (c1*3+c2-5)^2 + (c1*5+c2-(-2))^2
To find the minimum, you will have to form the partial derivatives with respect to c1 and c2 and set them to zero.
After you've done this, you'll find the A and b in your equation from above.
Best wishes
Torsten.

カテゴリ

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