Why am I getting a blank graph

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

 采纳的回答

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 个评论

Thank you very Much for your help.
Just a quick question. Why is that I cant see a line ( a graph) that represents the Infected ie the Purle coloured line.
Thanks in Advance
As always, my pleasure!
The original plot call plots ‘I’ twice — one as 'm' and once as 'g' — and ‘T’ is not plotted at all.
This reveals both of them:
plot(t,S,'b',t,I,'m',t,Se,'r',t,T,'g',t,R,'k',t,N,'y','Linewidth',5)
.
Thank you once again, It is nor working perfectly. Be blessed.
As always, my pleasure!
Thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by