%
% Lotka-Volterra model of predator-prey interaction, allowing logistic
% term in prey equation (controlled by epsilon) and harvesting (of fishing)
% of prey (controlled by f).
% Choose epsilon=0 and f=0 for standard Lotka-Volterra model
%
%
function LotVolt
clear;
close;
time_end=20;
alpha=input('alpha=')
epsilon=input('epsilon=')
f=input('f=')

options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4]);
[T,Y] = ode45(@lveoms,[0 time_end],[0.2 0.2],options);
plot(T,Y(:,1),'-b',T,Y(:,2),'-r','LineWidth',3);
axis([0 time_end 0 5]);
pause;
close;
[T,Y] = ode45(@lveoms,[0 time_end],[0.2 0.2],options);
plot(Y(:,1),Y(:,2),'-b','LineWidth',3);
axis([0 5 0 5]);
hold on;
[T,Y] = ode45(@lveoms,[0 time_end],[0.3 0.3],options);
plot(Y(:,1),Y(:,2),'-g','LineWidth',3);
[T,Y] = ode45(@lveoms,[0 time_end],[0.4 0.4],options);
plot(Y(:,1),Y(:,2),'-r','LineWidth',3);
pause;
hold off;
close;

function dy=lveoms(t,y)
%  returns the coupled odes
    dy=zeros(2,1);
    dy(1)=y(1)*(1-y(2))-epsilon*y(1)*y(1)-f;
    dy(2)=-alpha*y(2)*(1-y(1));
end
end







