Differential Equation Direction field

2k Views Asked by At

What i want to achieve:

I want to plot the direction fields of the following three differential equations:

1. Malthusian growth model: $p'(t)=\lambda*p(t)$ with $\lambda=1$ and $p(t)=t$

2. Linear growth model with saturation: $p'(t)=\lambda_0-\lambda_1*p(t)$ with $\lambda_0=1, \lambda_1=2$ and $p(t)=t$

3. Logistic growth model: $p'(t)=a*p(t)-b*p(t)^2$


What i have done so far:

For 1. and 2. i have used Matlab to produce the direction fields. The code reads as follows:

%Malthusian growth model
[x,t]=meshgrid(0:0.1:1,0:0.1:1);
dt = 1*t;
dx=ones(size(dt));
quiver(x,t,dx,dt);

Malthusian growth Model

%Linear growth model with saturation
[x,t]=meshgrid(0:0.1:1,0:0.1:1);
dt = 1-2*t;
dx=ones(size(dt));
quiver(x,t,dx,dt);

Linear growth model with saturation

Please note that on the picture for 2. at $\frac{\lambda_0}{\lambda_1}=\bar{p}=\frac{1} {2}=0.5$ the slopes have 0 inclination. (point of equilibrium)


What doesn't work:

Firstly, I am not 100% sure wether the direction fields for 1. and 2. are correct. I need an OK or NOT OK or NOT 100% OK on both.

Secondly: The logistic growth model has a point of equilibrium at $\bar{p}=\frac{a}{b}$.
But my problem is that my direction field in Matlab does not "hit" the point of equilibrium (like it is for example the case in the Linear growth model with saturation plot depicted in 2). I produce a plot for 3. using the following code:

%Logistic growth model
[x,t]=meshgrid(0:1:12,0:1:12);
dt = 1*t-0.1*t^2;
dx=ones(size(dt));
quiver(x,t,dx,dt);

Logistic growth model

According to $\bar{p}=\frac{a}{b}=\frac{1}{0.1}=10$ there should be the point of equilibrium at 10. But obviously the slopes are not 0. What can i do to produce a plot similar (without the black solution lines) to the following one, in which there is clear convergence to the point of equilibrium visible from all starting values:

logistic growth correct


EDIT:

After changing the code for equation/plot 3. to:

%Logistic growth model
[x,t]=meshgrid(0:1:12,0:1:12);
dt = 1*t-0.1*t.^2;
dx=ones(size(dt));
quiver(x,t,dx,dt);

The plot had the desired characteristics in terms of the point of equilibirum:

Logarithmic Growth model corrected