MATLAB: I want to know about plotting complex function

complex functioncomplex numbersplot

I want to know about this homework as i show you this images.
I should submit this homework including code,x-y plane graph and u,v plane graph.
z=x+iy and f(z)=2/(z-1)=u(x,y)+iv(x,y) (i is imaginary numbers)
please help me

Best Answer

clear; clc;
% entire z-plane
x=-3:0.01:3;
y=-3:0.01:3 ;
% our z region
zregion=[];
for n=1:length(x)
for k=1:length(y)
z=x(n)+y(k)*1i;
if abs(z-2)<1
zregion=[zregion z];
end
end
end
% mapping
fzRegion=[];
for n=1:length(zregion)
z=zregion(n);
fz=2/(z-1);
fzRegion=[fzRegion fz];
end
% plot these two regions
figure;
subplot(1,2,1);
plot(real(zregion), imag(zregion), 'b.'); zoom on; grid on; hold on;
plot( [-5 5],[0 0 ], '-k', 'LineWidth', 2 );
plot( [0 0],[-5 5 ], '-k', 'LineWidth', 2 );
axis square;
xlabel('x'); ylabel('y'); title('abs(z-2)<1')
subplot(1,2,2);
plot(real(fzRegion), imag(fzRegion), 'r.'); zoom on; grid on; hold on;
plot( [-200 200],[0 0 ], '-k', 'LineWidth', 2 );
plot( [0 0],[-200 200 ], '-k', 'LineWidth', 2 );
axis square;
xlabel('u'); ylabel('v'); title('f(z)');
But be careful... Point z1=1+j0 is a boundary point of your z-region. As z is approaching z1, f(z) going to infinity.
If you run the above script, you will receive the following graph: