fit data with a line

ok

1 件のコメント

darova
darova 2020 年 6 月 19 日
please don't remove your question

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 6 月 19 日

0 投票

Try something like this
x = linspace(0, 1, 100);
y = 3*x + 2 + rand(size(x));
pf = polyfit(x, y, 1);
y_pred = polyval(pf, x);
r2 = rsquare(y, y_pred); % R-squared
sse = sum((y-y_pred).^2); % SSE

2 件のコメント

Sarah Smith
Sarah Smith 2020 年 6 月 19 日
is rsqaure a function?
Ameer Hamza
Ameer Hamza 2020 年 6 月 19 日

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

2020 年 6 月 19 日

コメント済み:

2020 年 6 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by