matlab中的inline函数问题
function xdot=odetest(t,x)
%龙格-库塔算法测试
%二阶非线性系统微分方程 xdotdot + 0.5*xdot + 2*x + x^2 = 0
%求系统在初始条件为x(0)=1,xdot(0)=0的数值解
%double x;
%%xdot(1,1)=x(2);
%xdot(2,1)=-0.5*x(2)-2*x(1)-x(1)^2;
tspan=[0 20];
x0=[0 1];
fun=inline('[x(2);-0.5*x(2)-2*x(1)-x(1).^2','x');
[t,x]=ode23(fun,tspan,x0);
figure;
plot(t,x);
上面为程序源代码,不过总是出现以下错误:
??? Error using ==> inline.feval at 26
Too many inputs to inline function.
Error in ==> funfun\private\odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode23 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> odetest at 12
[t,x]=ode23(fun,tspan,x0);
麻烦大家帮忙解决一下