%Stability
%Integration by Implicit Euler Method

clear all


hlambdaR=[-4:0.01:2];
hlambdaI=[-3:0.01:3];

for i=1:601
   for j=1:601
      Z(i,j)=(1+hlambdaR(i))^2+hlambdaI(j)^2;
   end
end


%Z=(1+hlambdaR).^2+hlambdaI.^2;

figure(1)
contourf(hlambdaR,hlambdaI,-Z,[-1 -1])
title('STABILITY - EXPLICIT EULER')
xlabel('\lambda_{R}h')
ylabel('\lambda_{I}h')
hold on
plot([0 0],[-3 3],'k-')
plot([-4 2],[0 0],'k-')
hold off

figure(2)
contour(hlambdaR,hlambdaI,-Z,[-1 -1])
title('STABILITY - EXPLICIT EULER')
xlabel('\lambda_{R}h')
ylabel('\lambda_{I}h')
hold on
plot([0 0],[-3 3],'k-')
plot([-4 2],[0 0],'k-')
hold off