function volterra(a,b,c,d,x0,y0,dt,nite)
%Initialisation of the variables (t is a vector in which
%time will be written)
x(1)=x0; y(1)=y0;
t(1)=0;
%Calculation of the critical point
xe=c/(d*b); ye=a/b;
%Calculation of x,y and t
for i=1:nite
x(i+1)=x(i)+dt*(a*x(i)-b*x(i)*y(i));
y(i+1)=y(i)+dt*(-c*y(i)+d*b*x(i)*y(i));
t(i+1)=i*dt;
end
%Plot of x(t) (cyan curve) and y(t) (magenta curve)
figure(1);
hold on
plot(t,x,'c');
plot(t,y,'m');
hold off
%Plot of initial conditions (magenta point)
% the critical point (cyan
point)
% y(x) (blue curve)
figure(2);
hold on
plot(x0,y0,'m+');
plot(xe,ye,'c+');
plot(x,y,'b');
hold off
%hold on is used in order to plot the results of another
%simulation on the same graphs
hold on
end
back to previous page