how can i found the best linear function representing the following points ???

1 回表示 (過去 30 日間)
ammar emad
ammar emad 2020 年 7 月 12 日
コメント済み: Star Strider 2020 年 7 月 12 日
x=[ 0 0.6 1.2 1.8 2.4 2.8 ]
f(x)=[ 1.1 2.5 4.9 6.4 9.3 14.1 ]

採用された回答

Star Strider
Star Strider 2020 年 7 月 12 日
Try this:
x=[ 0 0.6 1.2 1.8 2.4 2.8 ]
fx=[ 1.1 2.5 4.9 6.4 9.3 14.1 ]
B = [x(:) ones(size(x(:)))] \ fx(:); % Estimate Parameters
Slope = B(1)
Intercept = B(2)
FitLine = [x(:) ones(size(x(:)))] * B;
figure
plot(x, fx, 'p')
hold on
plot(x, FitLine, '-r')
hold off
grid
A linear fit may not be entirely appropriate, becausse there is an obvious trend in the residuals.
.
  2 件のコメント
ammar emad
ammar emad 2020 年 7 月 12 日
OMG . man i really appreciate it and thank you so mush for helping me....
Star Strider
Star Strider 2020 年 7 月 12 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by