Q5.3-19E

Question

Predator-Prey Model. The Volterra–Lotka predator-prey model predicts some rather interesting behavior that is evident in certain biological systems. For example, suppose you fix the initial population of prey but increase the initial population of predators. Then the population cycle for the prey becomes more severe in the sense that there is a long period of time with a reduced population of prey followed by a short period when the population of prey is very large. To demonstrate this behavior, use the vectorized Runge–

Kutta algorithm for systems with h=0.5 to approximate the populations of prey and of predators over the period [0, 5] that satisfy the Volterra–Lotka system x'=x(3-y),y'=y(x-3)

 under each of the following initial conditions:

(a)x(0)=2,y(0)=4(b)x(0)=2,y(0)=5(c)x(0)=2,y(0)=7

Step-by-Step Solution

Verified
Answer

The solution can get by the Matlab method.

1Transform the equation

Write the equation as x'=x3-yandy'=yx-3

The initial conditions are:

x1(0)=2,2,2x2(0)=4,5,7

2Apply Runge –Kutta method

For the solution apply the Runge-Kutta method in MATLAB for

 

Now the algorithm is:

 

function[t,x] = Runge_Kutta(f,t0,t_end,init_cond,h)
 %we begin at time t0 and end when we reach t_end
 %init_cond(i) contains the initial value of x_i
 %f contains functions such that x_i'=f_i(t,x1,x2,...)
 
 t(:,1)=t0; % t0 is the initial value of t
 x(:,1)=init_cond; % initial conditions are set
 
 i=1;
 while t(:,i) < t_end 
 
     k1=f(t(i),x(:,i));
     k2=f(t(i)+0.5*h,x(:,i)+0.5*h*k1);
     k3=f(t(i)+0.5*h,x(:,i)+0.5*h*k2);
     k4=f(t(i)+h,x(:,i)+h*k3);
 
      x(:,i+1)=x(:,i)+(h/6)*(k1+2*k2+2*k3+k4);
 
     t(:,i+1)=t(:,i)+ h;
 i=i+1;

 end

 

Now 

clear all
 
 init_cond_a=[2;4];
 init_cond_b=[2;5];
 init_cond_c=[2;7];
 
 f=@(t,X) [X(1)*(3-X(2));X(2)*(X(1)-3)];
 
 [t,xa] = Runge_Kutta(f,0,5,init_cond_a,0.5);
 [t,xb] = Runge_Kutta(f,0,5,init_cond_b,0.5);
 [t,xc] = Runge_Kutta(f,0,5,init_cond_c,0.5);
 
 
 table(t',xa(1,:)',xa(2,:)',xb(1,:)',xb(2,:)',xc(1,:)',xc(2,:)','VariableNames',{'t','x_part_a','y_part_a','x_part_b','y_part_b','x_part_c','y_part_c'})


t

X for a

Y for a

X for b

Y for b

X for c

Y for b

0

2

4

2

5

2

7

0.5

1.95

2.25

1.48

2.42

0.91

2.79

1

3.34

1.836

2.66

1.45

1.63

1.13

1.5

4.53

3.365

5.19

2.40

4.49

1.07

2

2.47

4.32

3.10

4.649

5.96

5.47

2.5

1.96

2.719

1.92

3.32

1.518

5.93

3

2.86

1.96

2.34

2.05

0.95

2.18


This is the required result.