Predator/Prey Model questions
Afficher commentaires plus anciens
I'm trying to create a predator prey model with three different populations.
I was able to construct this using my notes/online tutorials, but I do not understand what all of this does (nor if I did this correctly). In my notes/ online tutorials, it seems p(1) would be the first population. I don't see where this is set up though and how it is updated. If anyone could explain how the computer reads these lines of , I'd greatly appreciate it.
function population
%initial conditions
h0=100; i0=1; v0=1;
IC=[h0,i0,v0];
t = [0 365];
B=0.07;
Ri=0.01;
Rv=0.01;
Di=0.03;
Dv=1;
Bv=0.03;
Rr=0.001;
[t,p]= ode15s(@RHS, t,IC );
figure(1)
plot(t ,p(:,1),'linewidth',2,'color','b')
hold on
plot(t ,p(:,2),'linewidth',2,'color','g')
hold on
plot(t ,p(:,3),'linewidth',2,'color','r')
grid on;
xlabel('time', 'FontSize', 20);
ylabel('Population', 'FontSize', 20);
function dpdt= RHS(t,p)
dpdt_1=(B*p(1)) - (Rv*p(1)*p(3)) - (Ri*p(1)*p(2)) + (Rr*p(2));
dpdt_2=(Ri*p(1)*p(2)) - (Di*p(2)) - (Rr*p(2));
dpdt_3=(Bv*(p(1)+p(2))*p(3))- (Dv*p(3));
dpdt=[dpdt_1;dpdt_2;dpdt_3];
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!