%STABILITY: MATLAB script M-file that locates
%equilibrium points for the Lotka-Volterra competition
%model, computes the Jacobian matrix for each 
%equilibrium point, and finds the eigenvalues of 
%each Jacobian matrix. The first calculation is 
%symbolic, the second with specific values.
syms y1 y2 r1 K1 s1 r2 K2 s2;
y = [y1, y2];
f=[r1*y1*(1-(y1+s1*y2)/K1), r2*y2*(1-(s2*y1+y2)/K2)];
[ye1 ye2] = solve(f(1),f(2))
J = jacobian(f,y)
for k=1:length(ye1)
y1 = ye1(k) 
y2 = ye2(k) 
A = subs(J)
lambda = eig(A)
pause
end
%With specific values
r1 = 1; r2 = 2; s1 = .5; s2 = 1; K1 = 1000; K2 = 1500;
for k=1:length(ye1)
y1 = eval(ye1(k)) 
y2 = eval(ye2(k)) 
A = subs(J)
lambda = double(eig(A))
pause
end

