y'1=-k1 y1+k2y1y2, y'2=k4y2-k3y1y2, y1(0)=y01, y2(0)=y02.Recall that algebraically we can solve this system of two nonlinear differential equations in terms of y1 and y2, but not y1(t) and y2(t) in t explicitly. MatLab has a function called ode45.m (same as ode23) which solves this system numerically. Type help ode45 to learn more about this function. Here is an example which uses ode45.m to solve the following system
y'1=-0.5y1+0.0006y1y2, y'2=3y2-0.002y1y2, y1(0)=100,y2(0)=1000, for t in [0,20].
function uv=funrw(t,y) k1=0.5; k2=.0006; k3=.002; k4=3; uv(1)=-k1*y(1)+k2*y(1)*y(2); uv(2)=k4*y(2)-k3*y(1)*y(2);
clf
clear
[tv yv1]=ode45('funwr',[0 20],[100;1000]);
plot(tv,yv1(:,1),':',tv,yv1(:,2),'--')
axis([0 20 0 10000])
text(4,7500,'y_1(0)=100')
text(4,4000,'y_2(0)=1000')
title('.. Wolves Population, -- Rabbits Population')
Function ode45.m generates a time vector tv and a two-column
vector yv whose two columns contain values of y1(t) and
y2(t), respectively. Graphs of y1 and y2
are given at the end of the assignment
Problem: Consider the system of differential equations with the following initial value conditions:
(a) y1(0)=100, y2(0)=1000;
(b) y1(0)=200, y2(0)=1000;
(c) y1(0)=400, y2(0)=1000.
(d) y1(0)=800, y2(0)=1000.
y'1=4y1-0.0003y12-0.0004y1y2 y'2=2y2-0.0002y1y2-0.0001y2y22 y1(0)=y01,y2(0)=y02 for t in [0,12].Problem: Use ode45.m to solve the system with the following initial conditions:
(a) y1(0)=1000, y2(0)=1000; (b) y1(0)=2000, y2(0)=2000; (c) y1(0)=3000, y2(0)=3000; (d) y1(0)=4000, y2(0)=4000.For each case, plot the solutions y1(t) and y2(t) for t in [0,12], and answer the following questions from the graphs or from the equations.