function hopf %parameters a=0.5; b=0.20; %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),'linewidth',2); xlabel('time'); ylabel('population'); legend('prey', 'predator'), pause plot(x(:,1),x(:,2),'linewidth',2); xlabel('prey'); ylabel('predator'); function dxdt=f(t,x) dxdt=[x(1)*x(1)*x(2)-x(1)+b; -x(1)*x(1)*x(2)+a]; end end