
theta = linspace(0,2*pi,250);
z = exp(1i*theta);

%% forward euler

lh = (z-1);
plot(real(lh),imag(lh),'b-','linewidth',2)
hold on
plot(zeros(250),linspace(-1,1,250),'k--','linewidth',2);

%% trapezoid rule 

lh = (z-1)./(.5*(z+1));
plot(real(lh),imag(lh),'b-','linewidth',2)
hold on
plot(zeros(250),linspace(-1,1,250),'k--','linewidth',2);

axis([-1 1 -1 1]) 

%% AB-2

lh = (z.^2-z)./(3/2*z-1/2);
plot(real(lh),imag(lh),'b-','linewidth',2)
hold on
plot(zeros(250),linspace(-1,1,250),'k--','linewidth',2);

%% midpoint 

z = [1 1i -1i -1];

lh = (z.^2-1)./(2*z);
plot(real(lh),imag(lh),'bo','linewidth',2)
hold on
plot(zeros(250),linspace(-2,2,250),'k--','linewidth',2);

axis(2*[-1 1 -1 1]) 