reactor_hw1.docx
DESCRIPTION
reactor designTRANSCRIPT
1.a:
k1=.02;k2=.00004;k3=.0004;k4=.04;tfinal = 500; f = @(t,x) [k1*x(1)-k2*x(1)*x(2);k3*x(1)*x(2)-k4*x(2)]; [t,xa] = ode45(f,[0 tfinal],[500 200]); plot(t,xa(:,1),'--',t,xa(:,2))title('case 1')xlabel('t'), ylabel('x')
Rabbits = ----Foxes = ____As rabbit population increases, fox population responds and also increases, causing the rabbit population to decrease. This cycles.
plot(xa(:,1),xa(:,2))title('foxes vs rabbits')xlabel('rabbits'), ylabel('foxes') For a single rabbit population, there are two fox solutions that correspond to different parts of the cycle
k3=.00004;tfinal=800; f = @(t,x) [k1*x(1)-k2*x(1)*x(2);k3*x(1)*x(2)-k4*x(2)]; [t,xa] = ode45(f,[0 tfinal],[500 200]);plot(t,xa(:,1),'--',t,xa(:,2))title('case 2')xlabel('t'), ylabel('x')These plots show the rabbit population reaching higher max levels than the fox population. This is because k3 was decreased so the growth rate of the fox population decreased
plot(xa(:,1),xa(:,2))title('foxes vs rabbits')xlabel('rabbits'), ylabel('foxes')This curve is shifted right compared case 1 because there are greater number of rabbits at all points.
If the death constant for rabbit is higher than the growth constant k2, the populations quickly reach a steady state of 0. The same result occurs is if the growth constant of the foxes after eating rabbits is higher than the death rate .04.
1.b:
fun=@eqn;x=fsolve(fun,[0,0]) % Output:% x =% % -0.1797 0.6202% eqn.m:% function F = eqn(x)% F(1) = (x(1)^3)*x(2)-(4*x(2)^2)+3*x(1)-1;% F(2) = (6*x(2)^2)-9*x(1)*x(2)-5;