MATLAB: Linear regression : estimate the parameters

linear regression

Hello! How can I estimate the parameters (beta1 and beata2) of the following model : y=beta1+beta2*x+epsilon Thanks.

Best Answer

Use polyfit.
p = polyfit(x,y,1);
beta1 = p(2);
beta2 = p(1);