matlab运行显示Undefined function or variable 'a'.
源程序是这样的functionf=cf(a,v)a=0;f=a(1)./(1+(a(1)/11.43-1)*exp(-a(2)*(v-1990)));t=1990:200...
源程序是这样的
function f=cf(a,v)
a=0;
f=a(1)./(1+(a(1)/11.43-1)*exp(-a(2)*(v-1990)));
t=1990:2005;
x=[11.43 11.58 11.72 11.85 11.99 12.11 12.24 12.36 12.48 12.58 12.67 12.76 12.85 12.92 13.00 13.08];
plot(t,x,'*',t,x)
hold on
a0=[0.001 1];
a=lsqcurvefit('cf',a0,t,x);
disp(['a=' num2str(a)]);
ti=1990:2017
xi=cf(a,ti);
polt(ti,xi,'r')
t1=2006;
x1=cf(a,t1)
hold off 展开
function f=cf(a,v)
a=0;
f=a(1)./(1+(a(1)/11.43-1)*exp(-a(2)*(v-1990)));
t=1990:2005;
x=[11.43 11.58 11.72 11.85 11.99 12.11 12.24 12.36 12.48 12.58 12.67 12.76 12.85 12.92 13.00 13.08];
plot(t,x,'*',t,x)
hold on
a0=[0.001 1];
a=lsqcurvefit('cf',a0,t,x);
disp(['a=' num2str(a)]);
ti=1990:2017
xi=cf(a,ti);
polt(ti,xi,'r')
t1=2006;
x1=cf(a,t1)
hold off 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询