function dx=hj(t,x)
F=32000; m=1400; u=18; g=9.8; s=0.4;
dx=(F-(m-u*t)*g-s*x*x)/(m-u*t);
运行:
>> clear
>> h=0.01;%所取时间点间隔
>> ts=[0:h:60];%粗略估计到时间60
>> x0=0;%初始条件
>> opt=odeset('reltol',1e-6,'abstol',1e-9);%相对误差1e-6,绝对误差1e-9
>> [t,x]=ode45(@hj,ts,x0,opt);%使用5级4阶龙格—库塔公式计算
出错:
??? Error using ==> feval
Undefined command/function 'hj'.
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, ...
速求答案,谢谢谢谢!!!