Finding Linear regression equation
55 ビュー (過去 30 日間)
古いコメントを表示
I have table of data
x = [65 65 62 67 69 65 61 67]
y = [105 125 110 120 140 135 95 130]
How can i find the equation y = mx+b of linear regression. I have tried so far but dont know how to find m and b ?
x = [65 65 62 67 69 65 61 67]
y = [105 125 110 120 140 135 95 130]
plot (x,y, 'r*')
lsline
% determine how many samples do we have
N= length(x)
% Fit to f(x) = b + m*x
X = [ones [N,1] x]
b = mldivide(X,y)
0 件のコメント
回答 (2 件)
参考
カテゴリ
Help Center および File Exchange で Linear and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!