(高手来)用matlab解下面的微分方程组并绘图(i随时间变化)t=0:1:20
di/dt=ks(t)-μi(t)ds/dt=ks(t)λ(1-p)dh/dt=-ds/dtdm/dt=i(t)(1-μ)k=0.4,p=0.6,λ=10,μ=1/30i...
di/dt=ks(t)-μi(t)
ds/dt=ks(t)λ(1-p)
dh/dt=-ds/dt
dm/dt=i(t)(1-μ)
k=0.4,p=0.6,λ=10,μ=1/30
i0=0.0000037,s0=0.000037,h=0.99995915,m0=0.00000015
可能是方程错了,换成这个
I(t+1)= S(t)/7-0.5I(t)
S(t+1)= I(t)*10+2.7S(t)
I(0)=397,S(0)=3970,
怎么用matlab解??正确加分 展开
ds/dt=ks(t)λ(1-p)
dh/dt=-ds/dt
dm/dt=i(t)(1-μ)
k=0.4,p=0.6,λ=10,μ=1/30
i0=0.0000037,s0=0.000037,h=0.99995915,m0=0.00000015
可能是方程错了,换成这个
I(t+1)= S(t)/7-0.5I(t)
S(t+1)= I(t)*10+2.7S(t)
I(0)=397,S(0)=3970,
怎么用matlab解??正确加分 展开
2个回答
展开全部
function num_diff
x0=[0.0000037,0.000037,0.99995915,0.00000015];
[t,x] = ode45(@myfun,[1,20],x0)
plot(t,x)
%axis([0 20 -10000 10000])
legend('i','s','h','m','Location','NorthWest')
function dx=myfun(t,x)
k=0.4;p=0.6;lmd=10;mu=1/30;
dx1=k*x(2)-mu*x(1);
dx2=k*x(2)*lmd*(1-p);
dx3=-dx1;%-(k*x(2)-mu*x(1));
dx4=x(1)*(1-mu);
dx=[dx1;dx2;dx3;dx4];
结果:
x =
3.7e-006 3.7e-005 0.99996 1.5e-007
1.0137e-005 6.3043e-005 0.99995 2.2938e-006
2.0833e-005 0.00010648 0.99994 7.0302e-006
3.9086e-005 0.00018078 0.99992 1.635e-005
7.0341e-005 0.00030817 0.99989 3.3546e-005
0.00010614 0.00045417 0.99986 5.3953e-005
0.0001586 0.00066821 0.9998 8.4436e-005
0.00023593 0.00098381 0.99973 0.00012996
0.0003501 0.0014499 0.99961 0.00019775
0.00051837 0.0021368 0.99944 0.00029823
0.00076502 0.0031438 0.9992 0.00044607
0.0011287 0.0046286 0.99883 0.00066463
....
x0=[0.0000037,0.000037,0.99995915,0.00000015];
[t,x] = ode45(@myfun,[1,20],x0)
plot(t,x)
%axis([0 20 -10000 10000])
legend('i','s','h','m','Location','NorthWest')
function dx=myfun(t,x)
k=0.4;p=0.6;lmd=10;mu=1/30;
dx1=k*x(2)-mu*x(1);
dx2=k*x(2)*lmd*(1-p);
dx3=-dx1;%-(k*x(2)-mu*x(1));
dx4=x(1)*(1-mu);
dx=[dx1;dx2;dx3;dx4];
结果:
x =
3.7e-006 3.7e-005 0.99996 1.5e-007
1.0137e-005 6.3043e-005 0.99995 2.2938e-006
2.0833e-005 0.00010648 0.99994 7.0302e-006
3.9086e-005 0.00018078 0.99992 1.635e-005
7.0341e-005 0.00030817 0.99989 3.3546e-005
0.00010614 0.00045417 0.99986 5.3953e-005
0.0001586 0.00066821 0.9998 8.4436e-005
0.00023593 0.00098381 0.99973 0.00012996
0.0003501 0.0014499 0.99961 0.00019775
0.00051837 0.0021368 0.99944 0.00029823
0.00076502 0.0031438 0.9992 0.00044607
0.0011287 0.0046286 0.99883 0.00066463
....
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询