离散数据拟合模型

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

工程技术大学上机实验报告

>> r r = 0.0212

>> sse sse = 1.7418e+004

程序代码:

>> p=(r,t)r(2).*exp(r(1).*(t-1790));

>> t=1790:10:2000;

>> c=[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];

>> r0=[0.0359,3.9];

>> r=nlinfit(t,c,p,r0);

>> sse=sum((c-p(r,t)).A2);

>> plot(t,c,'b*',1790:1:2000,p(r,1790:1:2000),'b')

>> axis([1790,2000,0,290])

>> xlabel('年份'),ylabel('人口(单位:百万)')

>> title('拟合美国人口数据-指数增长型')

>> legend('拟合数据')

程序调用:

>> r r =0.0142 14.9940

>> sse sse = 2.2639e+003

程序代码:

>> p=(r,t)r(2).*exp(r(1).*(t-1790+1.*r(3)));

>> t=1790:10:2000;

>> c=[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];

>> r0=[0.0359,3.9,1];

>> [r,x]=nlinfit(t,c,p,r0);

>> sse=sum((c-p(r,t)).A2);

>> a=1790+1.*r(3);

>> subplot(2,1,1)

>> plot(t,c,'b*',1790:1:2000,p(r,1790:1:2000),'b')

>> axis([1790,2000,0,290])

>> xlabel('年份'),ylabel('人口(单位:百万)')

>> title('拟合美国人口数据-指数增长型')

>> legend('拟合数据')

>> subplot(2,1,2)

>> plot(t,x,'k+',[1790:2000],[0,0],'k')

>> axis([1790,2000,-20,20])

>> xlabel('年份'),ylabel('人口(单位:百万)')

>> title('拟合误差')

程序调用:

>> r r = 0.0142 7.3264 50.3522

>> x x =

Columns 1 through 5 -11.0940 -11.9857 -12.7277 -13.3735 -13.5848 Columns 6 through 10 -13.4328 -11.9995 -9.1795 -8.1818 -3.7321 Columns 11 through 15 0.7248 4.3218 9.3664 11.2364 13.3761

Columns 16 through 20 5.0903 4.7390 11.0299 10.0111 2.8613

Columns 21 through 22 -6.4202 -15.8260

>> sse sse = 2.2639e+003

>> a a = 1.8404e+003

Columns 1 through 4 0.0005 0.0004 0.0003 0.0002 Columns 5 through 8 0.0000 0.0000 0.0008 0.0042 Columns 9 through 12 0.0066 0.0166 0.0297 0.0404 Columns 13 through 16 0.0556 0.0518 0.0428 0.0039

Columns 17 through 20 0.0008 0.0076 0.0684 0.3049 Columns 21 through 22 0.8732 1.9802

c2 = 3.4892e+004

f] Fiqunc I

__ _____________ A _■ dflk.___J

£i#" £dit 址,■ ]nwi Jo-olf Q^^klop Window jHtlp

□ da li| | \ 7

oTj □ H ~S"p

3、请分析指数增长模型非线性拟合和线性化拟合的结果有何区别?原因是 什么?

x(t)

(N NX

°)「(tt 。)模拟美国人口 1790 年至

2000年的变化过程,请用 Matlab 统计工具箱的函数

nlinfit 计算阻滞增长的以下

三个数据拟合问题:

(1) 取定X 0=3.9, t 0=1790,拟合待定参数r 和N;

程序代码:

>> p=(a,t)(a(2).*3.9)./(3.9+(a(2)-3.9).*exp(-a(1).*(t-1790))); >> t=1790:10:2000; >>

c=[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]; >> a=nlinfit(t,c,p,[0.03,350]) >> sse=sum((c-p(a,t)),2) >> plot(t,c,'r*',t,p(a,t),'r')

-1C

线性拟合

4、如果用阻滞增长模型

相关文档
最新文档