% Plot the image of the strip -pi i<z< pi i

% clear figures and variables
close all
clear

% Define function
% fn = @(z) exp(-z)+exp(z);
fn = @(z) z.^2;
fn = @(z) exp(z);

% Plot grid in z-plane
t = -pi: 0.05: pi;
subplot(1,2,1)
hold on
for s=-pi: 0.25: pi
    if s<0
        plot(s + i*t,'b')        % Plot vertical grid lines Re(z)<0
    else
        plot(s + i*t,'r')        % Plot vertical grid lines Re(z)>0
    end
    
    plot(s*i + t,'k')            % plot horizontal grid lines
end

axis( [-pi,pi, -pi,pi] )
hold off
axis square
title('z-plane')

% Plot image of grid under fn()
subplot(1,2,2)
hold on
for s=-pi: 0.25: pi
    plot(fn(s + i*t),'b')
     if s<0
        plot(fn(s + i*t),'b')    % Plot images of lines Re(z)<0
    else
        plot(fn(s + i*t),'r')    % Plot images of lines Re(z)>0
    end
   plot(fn(i*s + t),'k')         % plot images of horizontal grid lines
end
axis( [-4,4, -4,4] )
hold off
axis square
title('w-plane')