How to plot with various initial conditions?
Afficher commentaires plus anciens
Edited: I want to plot

using the model with different initial conditions(use whatever you like)
function dydt = model (t,y)
dydt = zeros (size(y));
Ah=0.000051;Av=0.071;b1=0.071;b2=0.091;g=0.0035;
d1=0.0000043;d2=0.04;e1=0.001;w=0.11;
Sh=y(1);
Ih=y(2);
Rh=y(3);
Sv=y(4);
Iv=y(5);
Nh = Sh+Ih+Rh;
%The model
dydt(1) = Ah - b1*Iv*Sh/Nh +w*Rh - d1*Sh;
dydt(2) = b1*Iv*Sh/Nh - (g + e1 + d1)*Ih;
dydt(3) = g*Ih - (w +d1)*Rh;
dydt(4) = Av - b2*Ih*Sv/Nh - d2*Sv;
dydt(5) = b2*Ih*Sv/Nh - d2*Iv;
% plot
tspan = [0 10000];
y0 = [3600 1000 100 9600 400];% Here is the initial condition
[t,y] = ode45(@model,tspan,y0);
plot(t,y(:,2),'r','Linewidth',1)
title('Plot of human population against time')
xlabel('Time(years)')
ylabel('Number of People')
legend('Infectious')
Regards,
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Grid Lines, Tick Values, and Labels 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!