function sir 

%parameters
beta=0.2;
alpha=1/7;
%intervals of time which to run the model
tspan=[0 100];
%the initial condition for susceptible and infected
x0=[0.95; 0.05];

[t,x]=ode45(@f,tspan,x0);

plot(t,x(:,1),t,x(:,2),t,1-x(:,1)-x(:,2),'linewidth',2);
xlabel('time');
ylabel('fractions');
legend('susceptible', 'infected', 'removed'), pause

plot(x(:,1),x(:,2),'linewidth',2);
xlabel('susceptible');
ylabel('infected');

function dxdt=f(t,x)
dxdt=[-beta*x(1)*x(2); beta*x(1)*x(2)-alpha*x(2)];
end
end