数学建模社区-数学中国

标题: 微分方程错误..Error using ==> feval [打印本页]

作者: 慢跑20    时间: 2013-5-11 17:18
标题: 微分方程错误..Error using ==> feval
课本传染病模型SIR.
先建立M文件
function y=ill(t,x)
a=1;b=0.3;
y=[a*x(1)*x(2)-b*x(1),-a*x(1)*x(2)]';
然后再MATLAB中输入:
ts=0:50;
x0=[0.02,0.98];
[t,x]=ode45('ill',ts,x0);[t,x]
Plot(t,x(:1,),t,x(:,2)),grid,pause
Plot(x(:,2),x(:,1)),grid
function y=ill(t,x)
a=1;b=0.3;
y=[a*x(1)*x(2)-b*x(1),-a*x(1)*x(2)]';

就会:
显示错误:
如下:
??? Error using ==> feval
Undefined command/function 'ill'.

Error in ==> funfun\private\odearguments at 110
f0 = feval(ode,t0,y0,args{:});   % ODE15I sets args{1} to yp0.

Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ...

>>
啥问题呢?





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