MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 非线性拟合小程序,不知哪错了,帮忙看下如何改 (https://www.labfans.com/bbs/showthread.php?t=16177)

qiumo2003ooo 2012-06-25 11:18

非线性拟合小程序,不知哪错了,帮忙看下如何改
 
建立ct.m
function y=ct(x)
y=x(1)*exp(-x(2)*t)

建立exam.m
t=[0.25 0.5 1 1.5 2 3 4 6 8];
c=[19.21 18.15 15.36 14.1 12.89 9.32 7.45 5.24 3.01];
x0=[10,0.5];
x=lsqcurvefit(@ct,x0,t,c)
tt=0:0.2:8;
yy=x(1)*exp(-x(2)*tt);
plot(tt,yy,t,c,'rp')


所有时间均为北京时间。现在的时间是 13:38

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.