model fit comparison matlab

조회 수: 10 (최근 30일)
Ilias Minas
Ilias Minas 2022년 5월 30일
편집: Hiro Yoshino 2022년 5월 31일
Hi all,
I have the following graph which shows the raw data of an experiment and the predicted data after executing 2 models.
I would like to compare which model fits better in the raw data.
I tried to use compare and goodnesofffit but the results didnt make sense.
Is there any alternative to this?
  댓글 수: 1
Hiro Yoshino
Hiro Yoshino 2022년 5월 30일
편집: Hiro Yoshino 2022년 5월 31일
Did you measure the goodness of fit like this?:
mse1 = mean((raw-oneState).^2)

댓글을 달려면 로그인하십시오.

답변 (1개)

Mathieu NOE
Mathieu NOE 2022년 5월 30일
hello
this is basically waht is called the R² correlation coefficient . If it get's close to 1 it's a good fit, if it get's close to zero there is no fit .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Rsquared = my_Rsquared_coeff(data,data_fit)
% R2 correlation coefficient computation
% The total sum of squares
sum_of_squares = sum((data-mean(data)).^2);
% The sum of squares of residuals, also called the residual sum of squares:
sum_of_squares_of_residuals = sum((data-data_fit).^2);
% definition of the coefficient of correlation is
Rsquared = 1 - sum_of_squares_of_residuals/sum_of_squares;
end

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by