用matlab解微分方程组(很急)!解这个微分方程组dx(1)=-k1*(x(1)+n*x(2))+g1*x(1)*x(3);dx(2)=-k2*(x(2)-n*x(1))+g2*x(2)*x(4);dx(3)=-(1+i1+abs(x(1))^2)*x(3)+i1-1;dx(4)=-(1+i2+abs(x(2))^2)*x(4)+i2-1;其中k1=1000;k2=1000;i1=4;i2=4;g1=10500

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 19:26:05
用matlab解微分方程组(很急)!解这个微分方程组dx(1)=-k1*(x(1)+n*x(2))+g1*x(1)*x(3);dx(2)=-k2*(x(2)-n*x(1))+g2*x(2)*x(4);

用matlab解微分方程组(很急)!解这个微分方程组dx(1)=-k1*(x(1)+n*x(2))+g1*x(1)*x(3);dx(2)=-k2*(x(2)-n*x(1))+g2*x(2)*x(4);dx(3)=-(1+i1+abs(x(1))^2)*x(3)+i1-1;dx(4)=-(1+i2+abs(x(2))^2)*x(4)+i2-1;其中k1=1000;k2=1000;i1=4;i2=4;g1=10500
用matlab解微分方程组(很急)!
解这个微分方程组
dx(1)=-k1*(x(1)+n*x(2))+g1*x(1)*x(3);
dx(2)=-k2*(x(2)-n*x(1))+g2*x(2)*x(4);
dx(3)=-(1+i1+abs(x(1))^2)*x(3)+i1-1;
dx(4)=-(1+i2+abs(x(2))^2)*x(4)+i2-1;
其中k1=1000;k2=1000;i1=4;i2=4;g1=10500;g2=4350;n=0.2;
再画出x(1)和x(2)的关系图

用matlab解微分方程组(很急)!解这个微分方程组dx(1)=-k1*(x(1)+n*x(2))+g1*x(1)*x(3);dx(2)=-k2*(x(2)-n*x(1))+g2*x(2)*x(4);dx(3)=-(1+i1+abs(x(1))^2)*x(3)+i1-1;dx(4)=-(1+i2+abs(x(2))^2)*x(4)+i2-1;其中k1=1000;k2=1000;i1=4;i2=4;g1=10500
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt=zhidao_rk4_t55262177(t,x)
k1=1000;k2=1000;i1=4;i2=4;g1=10500;g2=4350;n=0.2;
dxdt=[
-k1*(x(1)+n*x(2))+g1*x(1)*x(3);
-k2*(x(2)-n*x(1))+g2*x(2)*x(4);
-(1+i1+abs(x(1))^2)*x(3)+i1-1;
-(1+i2+abs(x(2))^2)*x(4)+i2-1;
];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在Matlab下面输入:
t_start=0;
t_end=10;
xx0=[0;1;0;0]; %初值
[t,x]=ode45('zhidao_rk4_t55262177',[0,t_end],xx0);
plot(x(:,1),x(:,2));
xlabel('x(1)');
ylabel('x(2)');
%具体的可以看一下论坛:

在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt=zhidao_rk4_t55262177(t,x)
k1=1000;k2=1000;i1=4;i2=4;g1=10500;g...

全部展开

在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt=zhidao_rk4_t55262177(t,x)
k1=1000;k2=1000;i1=4;i2=4;g1=10500;g2=4350;n=0.2;
dxdt=[
-k1*(x(1)+n*x(2))+g1*x(1)*x(3);
-k2*(x(2)-n*x(1))+g2*x(2)*x(4);
-(1+i1+abs(x(1))^2)*x(3)+i1-1;
-(1+i2+abs(x(2))^2)*x(4)+i2-1;
];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在Matlab下面输入:
t_start=0;
t_end=10;
xx0=[0;1;0;0]; %初值
[t,x]=ode45('zhidao_rk4_t55262177',[0,t_end],xx0);
plot(x(:,1),x(:,2));
xlabel('x(1)');
ylabel('x(2)');
用dsolve命令

收起