Can you help me with the MATLAB code?
1 回表示 (過去 30 日間)
古いコメントを表示
I have been given the following information
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/747449/image.png)
I have found the values of a, b and c with MATLAB. I got the values (a, b, c) = (32.5, 25.5, 7.5) through the normal equation and least-squares fit on the data.
My question is: How do i calculate the absolute error below in MATLAB?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/747454/image.png)
I am supposed to state it with two decimal places:
0 件のコメント
採用された回答
KSSV
2021 年 9 月 23 日
LEt a, b, c be your coefficients and (x,y) be your data.
y0 = y ; % given data
y1 = a+b*x+c*(x.^2-1) ; % approximated data
abs_error = sum(abs(y0-y1)) ;
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!