% Plots xy plane and uv plane for given function
% See complexgrid2.m to only plot uv plane
% See complexplot.m to plot single lines

clear
close all

% Enter function

%fn = @(z) x;
 fn = @(z) z.^2;
%fn = @(z) exp(z);
%fn = @(z) 1./(z.*(1/2-z).*(z-i).*(z-i+1));
%fn = @(z) sqrt(z+1);
%fn = @(z) (z-i)./(z+i);

% Vertical lines and images
for p=-0:0.25:2;
t = 0: 0.05: 2;
h = p + t*i;

% Plot domain lines
subplot(1,2,1)
plot(h,'k','LineWidth',1)
axis( [-2,2, -2,2] )
axis square; %grid on
hold on

% Plot image curves
subplot(1,2,2)
plot(fn(h),'k','LineWidth',1)
axis( [-4,4, -4,4] )
axis square; %grid on
hold on
end

% Horizontal lines and images
for p=0.0001:0.25:2;   
t = 0: 0.05: 2;
h = p*i + t;
%h = 1*i + t;

% Plot domain lines
subplot(1,2,1)
plot(h,'k--','LineWidth',1)
axis( [-2,2, -2,2] )
axis square; 
set(gca,'FontSize',14)
xlabel('\itx','FontSize',14)
ylabel('\ity','FontSize',14,'Rotation',0)
hold on

% Plot image curves
subplot(1,2,2)
plot(fn(h),'k--','LineWidth',1)
axis( [-4,4, -4,4] )
axis square; 
set(gca,'FontSize',16)
xlabel('\itu','FontSize',16)
ylabel('\itv','FontSize',16,'Rotation',0)
hold on
end
hold off
set(gcf,'Color',[1,1,1])