《科学计算科学计算 (40).pdf》由会员分享,可在线阅读,更多相关《科学计算科学计算 (40).pdf(21页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、6.66.6 Application Application Examples Examples of of Ordinary Ordinary Differential EquationsDifferential EquationsLotka-Volterra model Improved Lotka-Volterra model1 1LotkaLotka-Volterra Volterra MModel odel The first-order nonlinear differential equations:In this,t for time,r(t)for the number of
2、 rabbits,f(t)for the number of foxes,and is a positive number.This system is cyclical.The period depends on the initial conditions.In other words,for any number of r(0)and f(0),there is always a time,t=tp,which can return the numbers of these two populations to their initial values.=+=drdtrrf rrdfdt
3、frf ff2,(0),(0)00 Under the condition of r0=300、f0=150、=0.01,find the solution of the system,and you will find that tpis close to.Create the curves of the r(t)and f(t)functions as well as the phase plane plot taking r and f as coordinate axis.Under the condition of r0=102、f0=198、=0.01,solve and draw
4、 the graph,and determine the cycle tp.Point(r0,f0)=(1/,2/)is a stable equilibrium point.If this is used as the initial value,the population will not change.If the initial value is close to this equilibrium point,then the quantity will not change significantly.Try drawing to verify.(1)Analyze the sys
5、tem modelx1(t)the number of rabbits at moment t x2(t)the number of foxes at moment tr1the growth rate when the rabbits live on their own r2the mortality rate when foxes live alone1the foxs ability to prey on rabbits 2the support ability of rabbits for foxes=dxdtx r11 1=dxdtx rx11112()=dxdtx r222=+dx
6、dtxrx22221()=dxdtx rx11112()=+dxdtxrx22221()It is assumed here that r1=2,r2=1,1=2=0.01,that is,the system model is as follows:=dxdtxx112(20.01)=+dxdtxx221(10.01)Solve the first question:The initial number of rabbits x1(0)=300,and the initial number of foxes x2(0)=150.rabbitFox=(t,x)x(1)*(2-0.01*x(2)
7、;x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,30,300,150)subplot(1,2,1);plot(t,x(:,1),-,t,x(:,2),-*);legend(x1(t),x2(t);xlabel(Time);ylabel(Number of species);grid onsubplot(1,2,2);plot(x(:,1),x(:,2)grid onWe can see that the rabbit and the fox are mutually restrictive.When the fox gradually increases,t
8、he rabbit gradually decreases.When the fox increases to a certain number,due to the fierce internal competition in the population,the number of the fox is reduced,which reduces the natural enemies of the rabbit,which in turn leads to the number of rabbits increases.When the number of rabbits increas
9、es to a certain number,competition among species intensifies,which in turn leads to a decrease in the number of rabbits.This cycle restricts each others development.Solve the second question:The initial number of rabbits x1(0)=15,and the initial number of foxes x2(0)=22.Solve the third question:The
10、initial number of rabbits x1(0)=102,and the initial number of foxes x2(0)=198.Solve the fourth question:Verify(1/,2/)is the stable equilibrium point.Take=0.01,so the stable equilibrium point(1/,2/)is(100,200),using this pointas the initial value to draw the image.rabbitFox=(t,x)x(1)*(2-0.01*x(2);.x(
11、2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,30,100,200);plot(t,x(:,1),-o,t,x(:,2),-*);legend(x1(t)-Rabbit,x2(t)-Fox);xlabel(Time);ylabel(Number of species);When the initial values are changed to(98,195),which is to get very close to the equilibriumpoint downward,its graph is drawn.rabbitFox=(t,x)x(1)*(2-
12、0.01*x(2);.x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,30,98,195);plot(t,x(:,1),-o,t,x(:,2),-*);legend(x1(t)-Rabbit,x2(t)-Fox);xlabel(Time);ylabel(Number of species);We finnd no intersection between the two graphs.The numbers of rabbits and foxes experience periodic fluctuations at their equilibrium po
13、ints respectively,but the numbers of the two dont change much.When the initial values is changed to(70,150)(when the downward deviation from theequilibrium point is far),its graph is drawn.rabbitFox=(t,x)x(1)*(2-0.01*x(2);.x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,30,70,150);plot(t,x(:,1),-o,t,x(:,2)
14、,-*);legend(x1(t)-Rabbit,x2(t)-Fox);xlabel(Time);ylabel(Number of species);We can find more fierce changes in the numbers of rabbits and foxes,but its still periodic.When the initial values are changed to(900,1600)(when the upward deviation from theequilibrium point is very far),its graph is drawn.r
15、abbitFox=(t,x)x(1)*(2-0.01*x(2);.x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,500,900,1600);plot(t,x(:,1),t,x(:,2);legend(x1(t)-Rabbit,x2(t)-Fox);xlabel(Time);ylabel(Number of species);We can find the numbers of rabbits and foxes change quite violently,but there are still cycles.2 2Improved LotkaImprove
16、d Lotka-Volterra Volterra MModelodelModified equation:Among this,t for time,r(t)for the number of rabbits,f(t)for the number of foxes,is a positive number,and R is also a positive number.Solve the equation on 50 time units under the original condition where r0=300 and f0=150,and then create a graph.
17、=+=drdtrRrrf rrdfdtfrf ff2(1),(0),(0)00 In the original model,the time function curves of fox number and rabbit number are drawn.In the improved model,the time function curves of fox number and rabbit number are drawn.In the original model,the relationship curve of the number of foxes to the number
18、of rabbitsis drawn.In the improved model,the relationship curve of the number of foxes to the number of rabbits is drawn.The first question:In the original model,the time function curves of fox number and rabbit number are drawn.rabbitFox=(t,x)x(1)*(2-0.01*x(2);.x(2)*(-1+0.01*x(1);plot(t,x(:,1),t,x(
19、:,2);legend(x1(t)-Rabbit,x2(t)-Fox);xlabel(Time);ylabel(Number of species);title(The curve of fox and rabbit numbers in the original model);rabbitFox=(t,x)2*x(1)*(1-x(1)/400-0.005*x(2);.x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,50,300,150);plot(t,x(:,1),t,x(:,2);legend(x1(t)-Rabbit,x2(t)-Fox);xlabel(
20、Time);ylabel(Number of species);title(The curve of fox and rabbit numbers in the improved model);The second question:In the improved model,the time function curves of fox number and rabbit number are drawn.After comparison we find that no matter how long the original model takes,the numbers of foxes
21、 and rabbits always fluctuate between their own equilibrium points.And in the improved model,although there are large fluctuations in the previous period,they fluctuate less and less over time.After a long enough period of time,the numbers of foxes and rabbits reaches a steady balance respectively,w
22、hich is closer to whats actually happening in nature.The third question:In the original model,the relationship curve of the number of foxes to the number of rabbits is drawn.rabbitFox=(t,x)x(1)*(2-0.01*x(2);.x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,50,300,150);plot(x(:,1),x(:,2);xlabel(Number of rab
23、bits);ylabel(Number of foxes);title(The relationship between fox number and rabbit number in the original model);rabbitFox=(t,x)2*x(1)*(1-x(1)/400-0.005*x(2);.x(2)*(-1+0.01*x(1);t,x=ode45(rabbitFox,0,50,300,150);plot(x(:,1),x(:,2);xlabel(Number of rabbits);ylabel(Number of foxes);title(The relations
24、hip between fox number and rabbit number in the improved model);The fourth question:In the improved model,the relationship curve of the number of foxes to the number of rabbits is drawn.Further improvements on the model:Take the environmental capacity of the fox into consideration.Considering the influence of other natural enemies of rabbits and natural enemiesof foxes.Consider natural disasters,human capture and other factors.