请问如何实现matlab解一阶微分方程组(用其自身命令如ode45等怎么写能运行出结果)
我不太会用matlab方程如下:dx1/dt=a*(x2-x1)+x4;dx2/dt=d*x1-x1*x3+c*x2;dx3/dt=x1*x2-b*x3;dx4/dt=x...
我不太会用matlab
方程如下:
dx1/dt=a*(x2-x1)+x4;
dx2/dt=d*x1-x1*x3+c*x2;
dx3/dt=x1*x2-b*x3;
dx4/dt=x2*x3+r*x4;
其中a,b,c,d,r均已知. 展开
方程如下:
dx1/dt=a*(x2-x1)+x4;
dx2/dt=d*x1-x1*x3+c*x2;
dx3/dt=x1*x2-b*x3;
dx4/dt=x2*x3+r*x4;
其中a,b,c,d,r均已知. 展开
1个回答
展开全部
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt=zhidao_rk4_5(t,x)
global a b c d r
x1=x(1);
x2=x(2);
x3=x(3);
x4=x(4);
dxdt=[
a*(x2-x1)+x4;
d*x1-x1*x3+c*x2;
x1*x2-b*x3;
x2*x3+r*x4;
];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在Matlab下面输入:
global a b c d r
a=1;
b=2;
c=3;
d=4;
r=5;
t_end=10; %时间计算的终点,即算到这个时间为止
x0=[1;1;1;1]; %x的初始值
[t,x]=ode45('zhidao_rk4_5',[0,t_end],x0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt=zhidao_rk4_5(t,x)
global a b c d r
x1=x(1);
x2=x(2);
x3=x(3);
x4=x(4);
dxdt=[
a*(x2-x1)+x4;
d*x1-x1*x3+c*x2;
x1*x2-b*x3;
x2*x3+r*x4;
];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在Matlab下面输入:
global a b c d r
a=1;
b=2;
c=3;
d=4;
r=5;
t_end=10; %时间计算的终点,即算到这个时间为止
x0=[1;1;1;1]; %x的初始值
[t,x]=ode45('zhidao_rk4_5',[0,t_end],x0);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询