急求MATLAB解常微分方程组数值解的解决方案我用MATLAB7.4的ODE45解四元常微分方程组,程序如下:function xdot = eqx(t,x);m = 0.5;alf = 0.15;K=[0.0265,0.1,0.15];Q=20;a=0.8;xdot = zeros(4,1);xdot(1) = Q - alf * x(1) * x(2) +
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 16:45:48
急求MATLAB解常微分方程组数值解的解决方案我用MATLAB7.4的ODE45解四元常微分方程组,程序如下:function xdot = eqx(t,x);m = 0.5;alf = 0.15;K=[0.0265,0.1,0.15];Q=20;a=0.8;xdot = zeros(4,1);xdot(1) = Q - alf * x(1) * x(2) +
急求MATLAB解常微分方程组数值解的解决方案
我用MATLAB7.4的ODE45解四元常微分方程组,程序如下:
function xdot = eqx(t,x);
m = 0.5;
alf = 0.15;
K=[0.0265,0.1,0.15];
Q=20;
a=0.8;
xdot = zeros(4,1);
xdot(1) = Q - alf * x(1) * x(2) + a*m*(x(1)+x(2)+x(3)+x(4));
xdot(2) = x(2) * (-m + K(2) * alf * x(1) - alf * x(3));
xdot(3) = x(3) * (-m + K(3) * alf * x(2) - alf * x(4));
xdot(4) = x(4) * (-m + K(4) * alf * x(3));
执行
>> [t,x] = ode45('eqx',[0 0.2] ,[0 125] ,[0 12.5e+3] ,[0 0.2e+3]);
后得到如下出错信息,
Error using ==> funfun\private\odearguments at 44
Correct syntax is ode45(EQX,tspan,y0,options).
Error in ==> ode45 at 173
[neq,tspan,ntspan,next,t0,tfinal,tdir,y0,f0,odeArgs,odeFcn,...
急求MATLAB解常微分方程组数值解的解决方案我用MATLAB7.4的ODE45解四元常微分方程组,程序如下:function xdot = eqx(t,x);m = 0.5;alf = 0.15;K=[0.0265,0.1,0.15];Q=20;a=0.8;xdot = zeros(4,1);xdot(1) = Q - alf * x(1) * x(2) +
调用方法:[t,x] = ode45(@eqx,[0 0.2] ,[0 1 1.1 1.25])x的初始值写在一个矩阵里.
另外你的函数定义时K少一维K(4),我给你加了一个:
function xdot = eqx(t,x);
m = 0.5;
alf = 0.15;
K=[0.0265,0.1,0.15,0.12];
Q=20;
a=0.8;
xdot = zeros(4,1);
xdot(1) = Q - alf * x(1) * x(2) + a*m*(x(1)+x(2)+x(3)+x(4));
xdot(2) = x(2) * (-m + K(2) * alf * x(1) - alf * x(3));
xdot(3) = x(3) * (-m + K(3) * alf * x(2) - alf * x(4));
xdot(4) = x(4) * (-m + K(4) * alf * x(3));
你那个函数里K(4)是多少啊?没有定义