Why am I getting a blank graph

2 views (last 30 days)
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

Accepted Answer

Star Strider
Star Strider on 14 Jun 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 Comments
Joseph Obuya
Joseph Obuya on 15 Jun 2020
Thank you once again, It is nor working perfectly. Be blessed.
Star Strider
Star Strider on 15 Jun 2020
As always, my pleasure!
Thank you!

Sign in to comment.

More Answers (0)

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!