필터 지우기
필터 지우기

how can i calculate R-squared for lsqnonlin function ?

조회 수: 4 (최근 30일)
Zahra Safari
Zahra Safari 2020년 9월 15일
댓글: Abdolkarim Mohammadi 2020년 9월 15일
i want to calculate R-squared of non linear regression of exponential function. but i don;t know what is its code??
the code that i have written:
clear;
clc;
close all;
%mix code: S100+NaOH 11.25 molar _conc_T8
%tdata = [0.5694 1.0000 2.0000 3.7326 8.0000 16.0000 32.0000 64.0000 ];
%sdata = [1.4367 1.1567 1.3750 2.9900 3.2000 33.0050 0.0000 46.3050 ];
tdata = ...
[0.5694 1.0000 2.0000 3.7326 16.0000 64.0000 ];
sdata = ...
[1.4367 1.1567 1.3750 2.9900 33.0050 46.3050 ];
beta= [1.003908069]
fun = @(x)x(1)*exp(-(x(2)./tdata).^beta)-sdata;
x0=[40,0.9];
options = optimoptions(@lsqnonlin,'Algorithm','trust-region-reflective');
[x,resnorm, residual] = lsqnonlin(fun,x0)
plot(tdata,sdata,'ko')
hold on
syms tlist
y = x(1)*exp(-(x(2)./tlist).^beta);
tlist = linspace(tdata(1),tdata(end));
y = subs(y);
plot(tlist,y,'b-')
xlabel time(day)
ylabel strength(MPa)
title('exponential Fit to Data')
legend('Data','exponential Fit S100 11.25 M conc T8')
hold off
  댓글 수: 1
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020년 9월 15일
https://blog.minitab.com/blog/adventures-in-statistics-2/why-is-there-no-r-squared-for-nonlinear-regression

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

답변 (0개)

카테고리

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