Why am I getting a blank graph

2 vues (au cours des 30 derniers jours)
Joseph Obuya
Joseph Obuya le 14 Juin 2020
Commenté : Star Strider le 15 Juin 2020
I have the comands below and am getting a blank graph, can someone help me please.
function SISeTR(~)
clear all
clc
set(0,'defaultaxesfontsize',30,'defaulttextinterpreter','latex');
Lambda = 0.4;
sigma = 0.7;
kappa = 0.02;
theta = 0.2;
Omega = 0.5;
tau = 0.2;
lambda = 0.1;
omega =0.01;
eta = 0.02;
mu = 0.025;
pi = 0.02;
delta = 0.035;
S0 = 999;
I0 = 1;
Se0 = 0;
T0 = 0;
R0 = 0;
x0 = [S0 I0 Se0 T0 R0];
Timepsan = [0 300];
[t,x] = ode45(@SISeTR,Timepsan,x0);
S = x(:,1);
I = x(:,2);
Se = x(:,3);
T = x(:,4);
R = x(:,5);
N = S +I + Se + T + R;
plot(t,S,'b',t,I,'m',t,Se,'r',t,I,'g',t,R,'k',t,N,'q','Linewidth',5)
xlabel('Time in days')
ylabel('Populations')
g=legend('Susceptibe,$S$','Infected,$I$','Sensitized,$Se$','Treated,$T$','Recovered,$R$','Total Population,$N$');
set(g,'Interpreter','latex');
function xdot = SISeTR(~,x)
S = x (1);
I = x (2);
Se = x (3);
T = x (4);
R = x(5);
N = S+I+Se+T+R;
Sdot = Lambda + omega*R - (mu + sigma*I + kappa)*S;
Idot = sigma*S*I + eta*Se + theta*T - (Omega + delta + mu + tau)*I;
Sedot = kappa*S + pi*R - (eta + mu)*Se;
Tdot = Omega*I - (theta + lambda + delta + mu)*T;
Rdot = tau*I + lambda*T - (pi + omega)*R;
xdot = [Sdot;Idot;Sedot;Tdot;Rdot];
end
end

Réponse acceptée

Star Strider
Star Strider le 14 Juin 2020
I changed the plot call to use 'y' instead of 'q' (that doesn’t exist), and eliminated the clear all and clc calls, and changed the set call to:
set(0,'defaultaxesfontsize',10,'defaulttextinterpreter','latex');
then it ran without error and produced:
I have no idea what problems you’re having iwth it.
  4 commentaires
Joseph Obuya
Joseph Obuya le 15 Juin 2020
Thank you once again, It is nor working perfectly. Be blessed.
Star Strider
Star Strider le 15 Juin 2020
As always, my pleasure!
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by