用四阶龙格库塔法求解K=2请问如何在MATLAB里得出N1 N2 P1 P2的一系列值,并绘出N1和P1,N2和P2之间的关系图?
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 14:56:16
用四阶龙格库塔法求解K=2请问如何在MATLAB里得出N1 N2 P1 P2的一系列值,并绘出N1和P1,N2和P2之间的关系图?
用四阶龙格库塔法求解
K=2
请问如何在MATLAB里得出N1 N2 P1 P2的一系列值,并绘出N1和P1,N2和P2之间的关系图?
用四阶龙格库塔法求解K=2请问如何在MATLAB里得出N1 N2 P1 P2的一系列值,并绘出N1和P1,N2和P2之间的关系图?
初值给一下.
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt=ode_Miss_ghost(t,x)
%分别用x(1),x(2),x(3),x(4)代替N1,P1,N2,P2
N1=x(1);
P1=x(2);
N2=x(3);
P2=x(4);
K=2;
tau_c=3e-9;
tan_p=6e-12;
beta =5e-5;
delta=0.692;
eta =0.0001;
fm =8e6;
Ith =26e-3;
Ib =1.5*Ith;
Im =0.3*Ith;
I1=Ib+Im*sin(2*pi*fm*t)+K*P2;
I2=Ib+Im*sin(2*pi*fm*t)+K*P1;
dxdt=[
(I1/Ith-N1-(N1-delta)/(1-delta)*P1)/tau_e;
((N1-delta)/(1-delta)*(1-eta*P1)*P1-P1+beta*N1)/tau_p;
(I2/Ith-N2-(N2-delta)/(1-delta)*P2)/tau_e;
((N2-delta)/(1-delta)*(1-eta*P2)*P2-P2+beta*N2)/tau_p;
];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在Matlab下面输入:
t_start=0;
t_end=2e-9;
y0=[1e-3;1e-4;0;0]; %初值
[x,y]=ode15s('ode_Miss_ghost',[0,t_end],y0);
plot(x,y);
legend('N1','P1','N2','P2');
xlabel('x');