function lv2_3d(r1,k1,n01,r2,k2,n02,alfaini,alfaend,alfastep,nostep)
%Lotka Volterra system 
%This function plots response surface of one species to competition coefficients
%and growth rate of one species

%r1, r2 - intrinsic growth rates for species 1 
%k1, k2 - carrying capacities
%n01, n02 - initial population sizes
%alfaini,alfaend,alfstep - minimum, maximum competition coefficient and difference between adjacent values
%nostep - number of steps for simulation



if alfaini >= alfaend | alfastep<=0 
   return;
end

start=min(100,nostep/2);
x=[];
z=[];
for alfa12=alfaini:alfastep:alfaend
   y=[];
   z1=[];
   for alfa21=alfaini:alfastep:alfaend
      x1=lv2_time(r1,k1,n01,r2,k2,n02,alfa12,alfa21,nostep);
      a=mean(x1(2,start:nostep)/(x1(1,start:nostep)+x1(2,start:nostep)));
      y=[y alfa21];
      z1=[z1 a];
   end
   x=[x alfa12];
   z=[z;z1];
end
%plot3(x,y,z);
surf(x,y,transpose(z));
xlabel('alfa12');
ylabel('alfa21');
zlabel('Proportion of species 2');

return;



