【问题标题】:Is this code for nonlinear regression in MATLAB right?MATLAB中非线性回归的这段代码对吗?
【发布时间】:2023-03-27 19:10:01
【问题描述】:

我正在尝试在 MATLAB 中解决这个示例,但我无法得到正确的答案。

我用这个代码

clear all;clc;
x=[4 2.25 1.45 1.0 0.65 0.25 0.006];
y=[ 0.398 0.298 0.238 0.198 0.158 0.098 0.048];
n=length(x);
sumx=sum(log10(x));
sumy=sum(log10(y));
sum2x=sum(log10(x));
sum3x=sum(log10(y));
sum4x=sum(log10(x.*y));
sumxy=sum(log10(x.^2));
sumx2y=sum(log10((x.^2) .*y)); 
m1=[n sumx sum2x;sumx sum2x sum3x;sum2x sum3x sum4x]
m2=[sumy;sumxy;sumx2y]
m3=inv(m1)*m2;
plot(x,y)

【问题讨论】:

    标签: matlab non-linear-regression


    【解决方案1】:

    这不只是为了对数据(-rC)进行幂拟合以获得常量nk

    如果是这样,您只需使用 MATLAB 中的曲线拟合应用程序即可:

    General model Power1:
         f(x) = a*x^b
    Coefficients (with 95% confidence bounds):
           a =      0.2003  (0.1826, 0.2179)
           b =      0.4889  (0.4028, 0.5751)
    
    Goodness of fit:
      SSE: 0.001052
      R-square: 0.9877
      Adjusted R-square: 0.9852
      RMSE: 0.0145
    

    【讨论】:

      猜你喜欢
      • 2013-10-25
      • 2016-05-24
      • 1970-01-01
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-14
      • 2017-06-17
      相关资源
      最近更新 更多