建模作业

更新时间:2023-12-31 22:08:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

P.11 >> clear;

>> t=1790:10:2000; >>

x=[3.9,5.3,7.2,9.6,12.9,17.1,23.2,31.4,38.6,50.2,62.9,76.0,92.0,106.5,123.2,131.7,150.7,179.3,204.0,226.5,251.4,281.4]; >> y=log(x);

>> p=polyfit(t,y,1) p =

0.0202 -34.3934

>> r=p(1),x0=exp(p(2)) r =

0.0202 x0 =

1.1565e-015 法二

>> Y=polyval(p,t); >> X=exp(Y);

>> fun=inline('a(1)*exp(a(2)*t)','a','t') format short g

a=nlinfit(t,x,fun,[1.7139e-010 0.02]);

fun =

Inline function:

fun(a,t) = a(1)*exp(a(2)*t) >> X0=a(1),rr=a(2) X1=a(1)*exp(a(2)*t); plot(t,x,'o',t,X,t,X1)

X0 =

1.3142e-010

rr =

0.014224

>> X0=a(1),rr=a(2) X1=a(1)*exp(a(2)*t);

X0 =

1.3142e-010 rr =

0.014224

>> plot(t,x,'+',t,X,t,X1)

x=0:10:110;

y=[3.9 5.3 7.2 9.6 12.9 17.1 23.2 31.4 38.6 50.2 62.9 76.0]; f=inline('a(1)*exp(a(2)*x)','a','x'); [xx,res]=lsqcurvefit(f,[4.1 0.2],x,y) y1=xx(1)*exp(xx(2)*x); >> plot(x,y,'k-o',x,y1,'k-*')

本文来源:https://www.bwwdw.com/article/aeix.html

Top