关于MATLAB的一些题目

2025-02-22 23:01:01
推荐回答(2个)
回答1:

主程序:
year=1790:10:2000;
popu=[3.9
5.3
7.2
9.6
12.9
17.1
23.2
31.4
38.6
50.2
62.9
76
92
106.5
123.2
131.7
150.7
179.3
204.0
226.5
251.4
281.4];
opt=statset('MaxIter',1000);
beta1
=
nlinfit(year,popu,@mymodel1,0.1,
opt)
beta2
=
nlinfit(year,popu,@mymodel2,[1
0.1],
opt)
mymodel1.m:
function
y=mymodel1(beta1,x)
y=3.9*exp(beta1*(x-1790));
mymodel2.m:
function
y=mymodel2(beta2,x)
y=beta2(1)*exp(beta2(2)*(x-1790));
结果
beta1
=
0.0212
beta2
=
14.9939
0.0142

回答2:

这些基本问题都可以在下面两个FAQ里面找到

http://bbs.dartmouth.edu/~fangq/MATH/FAQ/

http://bbs.hit.edu.cn/bbscon.php?board=Matlab&id=2606&ftype=11