我这儿有一组若干年份的数据,是按一定时间顺序排的,想用曲线拟合法得到2010年的人均国内生产总值,不知怎么用matlab,高手赐教!!!!!!可加分年份 人均国内生产总值(元) 1996 27000 1997 30619 1998 33282 1999 336892000 410202001 433442002 460302003 538872004 592712005 645072006 7059707.1季 2050507.2季 19619 07.3季 19874 07.4季 1922308.1季 19703
clc;clearA=[...1996 270001997 306191998 332821999 336892000 410202001 433442002 460302003 538872004 592712005 645072006 70597]B=[...071 20505072 19619073 19874074 19223081 19703]t=[A(:,1);2007]GNP=[A(:,2);sum(B(1:4,2))]pre=inline('a(1)*exp(a(2)*(t-1996))','a','t') format short ga=nlinfit(t,GNP,pre,[3.305e-81 0.09795])T=1995:2015;PreGNP=a(1)*exp(a(2)*(T-1996));temp=[NaN;GNP;NaN*ones(2015-2007,1)]'Table=[T;PreGNP;temp]'plot(t,GNP,'o',T,PreGNP)grid结果:a = 26758 0.09795Table = 1995 24261 NaN 1996 26758 27000 1997 29512 30619 1998 32549 33282 1999 35898 33689 2000 39593 41020 2001 43667 43344 2002 48161 46030 2003 53117 53887 2004 58583 59271 2005 64611 64507 2006 71260 70597 2007 78594 79221 2008 86682 NaN 2009 95602 NaN 2010 1.0544e+005 NaN 2011 1.1629e+005 NaN 2012 1.2826e+005 NaN 2013 1.4146e+005 NaN 2014 1.5601e+005 NaN 2015 1.7207e+005 NaN可见,2010年是1.0544e+005 图形见:http://hi.baidu.com/chemical%5Fengineering/album/item/7e32a3cc4c788e0300e928c7.htmlhttp://hiphotos.baidu.com/chemical%5Fengineering/pic/item/7e32a3cc4c788e0300e928c7.jpg |
|