www.mh456.com防采集。
对于bai还有年份的拟合问题,应按序列du向量来zhi处理,这样拟合的dao结果是有效的。即
用cftool工具箱可拟合函数: ① General model Exp1: f(x) = a*exp(b*x) + c*exp(d*x) where x is normalized by mean 18.33 and std 14.39 Coefficients (with 95% confidence bounds): a = 0.6468 (0.5734, 0.7201) b = 0.01806 (-0.09362, 0.1
x=[2009 2010 2011 2012 2013] 应改写为专 x=1;5; %2009-属2013年
clear;clc syms a b c d x=[5 10 15 20]; y=[0.9398 0.9357 0.9286 0.7548]; eq1=a*exp(b*x(1))+c*exp(d*x(1))-y(1); eq2=a*exp(b*x(2))+c*exp(d*x(2))-y(2); eq3=a*exp(b*x(3))+c*exp(d*x(3))-y(3); eq4=a*exp(b*x(4))+c*exp(d*x(4))-y(4); [a
具体实施代码如下
用cftool工具箱可拟合函数: ① General model Exp1: f(x) = a*exp(b*x) + c*exp(d*x) where x is normalized by mean 18.33 and std 14.39 Coefficients (with 95% confidence bounds): a = 0.6468 (0.5734, 0.7201) b = 0.01806 (-0.09362, 0.1
x=1;5;
如果有具体数字,可以尝试使用double变量 每0.0001一次进行迭代。 double x = 0; for(double y=1;y
y=[74.08 87.42 94.39 113.08 139.65];
lsqcurvefit或者lsqnonlin函数拟合
fun=@(a,x)[a(1).*exp(a(2)*x)+a(3).*exp(a(4)*x)];
%a=a(1),b=a(2),c=a(3),d=a(4)
x0=[1 0.3 0.5 0.2]
a= nlinfit(x,y,fun,x0
d=a(4),c=a(3),b=a(2),a=a(1)
运行结果
d = 0.116774298952341
c = 66.7544631579477
b = 1.2220839296099
a = 0.0444737875381383
对比图形
追问请问如何设置左上角图示和横坐标为2009-2013?谢谢追答可用set()函数来设置.
a= 0.0208b= 0.9515 c= 1.0649d= -2.1877当x=1.64时,y=0.1287,以后碰到这种问题,matlab有一个cftool工具,使用简单。线性的、指数的、幂函数等等常见的方程的系数都能求出来,详情见附件内容来自www.mh456.com请勿采集。