作业帮 > 综合 > 作业

问下matlab 中 nlinfit怎么用

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/09/21 15:21:19
问下matlab 中 nlinfit怎么用
nlinfit怎么用呢 什么情况下使用 求出的是什么
有例子么
问下matlab 中 nlinfit怎么用
x=[1.1389 1.0622 0.9822 0.934 0.9251 0.9158];
y=[0.03 1 5.03 15.05 19.97 30.3];
拟合函数为y=-k*ln(x+a)-b;
nlinfit 非线性参数拟合
clc;clear;
x=[1.1389 1.0622 0.9822 0.934 0.9251 0.9158];
y=[0.03 1 5.03 15.05 19.97 30.3];
myfunc=inline('-beta(1)*log(x+beta(2))-beta(3)','beta','x');
beta=nlinfit(x,y,myfunc,[0 0 0]);
k=beta(1),a=beta(2),b=beta(3)
%test the model
xx=min(x):max(x);
yy=-k*log(x+a)-b;
plot(x,y,'o',x,yy,'r')