Application examples of MATLAB drawing solution curves in mathematical modeling (Biomathematics) (2/3)

1. Purpose of the experiment:

Understand and master the use of MATLAB to draw solution curves in biomathematics-related equations.

2. Experimental content

For example,   the state equation of the well-known Lorenz model is expressed as follows

 

Among them, set . If its initial value is a small constant that can be recognized on the machine, for example, choose a small positive number and try to solve it by drawing a graph.

Practice (choose two)

1. The limit cycle is a common phenomenon in second-order nonlinear ordinary differential equations. For some nonlinear differential equations, no matter what the initial state is, the phase trajectory of the differential equation will be stable on a closed curve. The curve is called the limit cycle of the differential equation. Try to get the initial value and draw the differential equation

 

The limit cycle, and replace the plot function with the comet function, and observe the process of drawing the animated trajectory.

2. The Lotka-Volterra predation model equation is

 

The initial value is to draw the corresponding curve.

3. Draw two situations in Figure 3.2.5 on page 50 of "Principles of Biomathematics".

4. Draw the three diagrams on pages 54 and 55 of "Principles of Biomathematics" (verify according to the given parameters) .

code:

Example 1

f=@(t,x)[-8/3*x(1)+x(2)*x(3);-10*x(2)+10*x(3);-x(1)*x(2)+28*x(2)-x(3)];

 t_final=100;x0=[0;0;1e-10];

 [t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure;

 plot3(x(:,1),x(:,2),x(:,3));

 axis([1 60 -20 20 -20 25]);

练习1.

f=@(t,x)[x(2)+x(1)*(1-x(1)^2-x(2)^2);-x(1)+x(2)*(1-x(1)^2-x(2)^2)];

t_final=100;x0=[0;1e-10];

[t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure;

 plot(x(:,1),x(:,2));

 axis([-1 1 -1 1])

练习3.

a=1

b=0.3

d=0.1

f=@(t,x)[x(1)*(1-x(1))-a*x(1)*x(2)/(x(1)+d);b*x(2)*(1-x(2)/x(1))]

t_final=100;x0=[3,3];

[t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure;

 plot(x(:,1),x(:,2));

 axis([0 1 0 1])

clear;clc

a=1

b=0.2

d=0.1

f=@(t,x)[x(1)*(1-x(1))-a*x(1)*x(2)/(x(1)+d);b*x(2)*(1-x(2)/x(1))]

t_final=100;x0=[3,3];

[t,x]=ode45(f,[0,t_final],x0);plot(t,x),figure;

 plot(x(:,1),x(:,2));

 axis([0 1 0 1])

例1.

练习1.

 

练习3.

a =      1

b =    0.300000000000000

d =    0.100000000000000

f = 包含以下值的 function_handle:

    @(t,x)[x(1)*(1-x(1))-a*x(1)*x(2)/(x(1)+d);b*x(2)*(1-x(2)/x(1))]

 

 

a =      1

b =    0.200000000000000

d =    0.100000000000000

f = 包含以下值的 function_handle:

    @(t,x)[x(1)*(1-x(1))-a*x(1)*x(2)/(x(1)+d);b*x(2)*(1-x(2)/x(1))]

分析与讨论:

  1. 生物学中的曲线图是把生物学问题进行数学模式化,并用图解形式阐述生物学事实、概念、原理和规律等。从曲线图的组成来看,其中应有自变量、因变量等相关变量,有时还包括第三变量;从整个过程来看,能反映出在一定的条件下所发生的生物学变化规律,它是一个连续的动态变化图。
  2. 极限环是二阶非线性常微分方程中一种常见现象,对某些非线性微分方 程来说,不论初始状态为何值,微分方程的相轨迹都将稳定在一条封闭的曲线上, 该曲线称为微分方程的极限环
  3. 对于例题的 Lorenz 模型,该方程为非线性微分方程,不存在解析解,只能用数值法求解。首先 先编写函数 f,其次调用 ode45( )函数进行数值求解并画图。 其中,t_final 为设定的仿真终止时间,x0 为初始状态。第一个绘图命令绘 制出系统各个状态和时间关系的二维曲线图,第二个绘图命令可以绘制出三个状 态的向空间曲线。 观 察 相 空 间 轨 迹 走 行 时 , 可 将 plot3(x(:,1),x(:,2),x(:,3)) 换 成 comet(x(:,1),x(:,2),x(:,3))。

 

 

Guess you like

Origin blog.csdn.net/qq_59819866/article/details/131454145