How to divide different graphs?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Muse Riveria
le 7 Jan 2016
Modifié(e) : Muse Riveria
le 16 Mar 2016
Is there anyway to divide this function up, and have the first 4 equations (dSdt(1) to dSdt(4)) computed into one graph and the remaining last 3 equations computed on a separate graph? This is a mathematical modelling question, with dSdt(1) to dSdt(4) representing the one population and dSdt(5) to dSdt(7) representing another population. to = 0; tf = 100; tspan = [to tf]; y0 = [5535002 50 50 0 0 0 0 ]; [t,S] = ode45(@denguefeverODE, tspan, y0); plot(t,S) title('Human Population Without Control') xlabel('Time') ylabel('Susceptible, Exposed, Infected, Recovered') legend('Susceptible', 'Exposed', 'Infected', 'Recovered') function dSdt = denguefeverODE(t,S) Nh = 5535002; Nm = 33210012; uh = 0.0045; um = 0.02941; Pmh = 0.375; Phm = 0.750; beta = 1; nu_h = 0.1666; epsilon_m = 0.1; tau_h = 0.1176; f = 6; dSdt = zeros(7,1); dSdt(1) = uh*Nh - (beta*Pmh*(S(7)/Nh)+uh)*S(1); dSdt(2) = beta*Pmh*(S(7)/Nh)*S(1) - (tau_h+uh)*S(2); dSdt(3) = tau_h*S(2)-(nu_h+uh)*S(3); dSdt(4) = nu_h*S(3)-uh*S(4); dSdt(5) = um*Nm - (beta*Phm*(S(3)/Nh)+um)*S(5); dSdt(6) = beta*Phm*(S(3)/Nh)*S(5); dSdt(7) = epsilon_m*S(6) - um*S(7);
Thank you!
0 commentaires
Réponse acceptée
Star Strider
le 7 Jan 2016
I ran your code and tested this (it works). Your figure becomes two figures, each plotting the columns of ‘S’ you want:
figure(1)
plot(t,S(:,1:4))
title('Human Population Without Control')
xlabel('Time')
ylabel('Susceptible, Exposed, Infected, Recovered')
legend('Susceptible', 'Exposed', 'Infected', 'Recovered')
figure(2)
plot(t,S(:,5:7))
title('Human Population Without Control')
xlabel('Time')
ylabel('Susceptible, Exposed, Infected, Recovered')
legend('Susceptible', 'Exposed', 'Infected', 'Recovered')
7 commentaires
Star Strider
le 8 Jan 2016
My pleasure!
This has been a genuine education for me, so I thank you as well. I’ll definitely look at those references.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Biomedical Imaging dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!