Can you help me with the MATLAB code?

조회 수: 1 (최근 30일)
Mads Yar
Mads Yar 2021년 9월 23일
답변: KSSV 2021년 9월 23일
I have been given the following information
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?
I am supposed to state it with two decimal places:

채택된 답변

KSSV
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개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by