フィルターのクリア

how can i calculate R-squared for lsqnonlin function ?

4 ビュー (過去 30 日間)
Zahra Safari
Zahra Safari 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 Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by