数学建模社区-数学中国

标题: 求助!matlab给定函数拟合数据 [打印本页]

作者: AXDUer    时间: 2014-1-22 11:19
标题: 求助!matlab给定函数拟合数据
x=1980:2010;
y=[63119.90;60953.37;59552.03;58782.90;59795.10;60084.96;61820.36;63106.83...
  ;64977.49;66089.67;66550.08;67214.85;67384.25;67589.48;68929.04;70132.21...
  ;71714.46;73464.43;74116.65;75880.45;76784.13;77475.67;78168.27;79712.25...
  ;82573.24;84077.29;85141.10;85908.09;84565.30;84812.65;87446.21];

代码:
syms t;
f=fittype('b1+b2*cos(b3*t+b4)+b5*exp(b6*t)','independent','t','coefficients',{'b1','b2','b3','b4','b5','b6'});
cfun=fit(x,y,f)
xi=1980:1:2060;
yi=cfun(m);
plot(x,z,'r*',xi,yi,'bo-');

拟合显示有Inf、NaN,用工具箱拟合有时候结果一样,有时候结果相差很远





欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5