# What does the phase of complex function mean and how can I plot it in matlab?

4 views (last 30 days)
Aisha Mohamed on 10 May 2022
Edited: Jan on 10 May 2022
I know that any complex number has a magntude and argument in the complex plane where the magnitude represent the length of the complex number and the the argument represent the angle that the complex number |z| make with the positive side of x axis.
My question is when I tried to plot the complex function I have great answer from this group and I applied this code in my complex function I can not understand why the plot of phase function take this form? I mean the phase function should be positive and I have to get a surface, so Why the plot take this form which I can not study it? is that mean I have some mistake in my plot?
this is the phse of f(z) and the |f(z)| (I have got this help from a genius in this group ).
My question is why the plot of phase function take this form? I think the phase plot must be surface and positive so what is the mistake in this graph?
% define the region on the complex plane to plot over:
re_z = -1:0.01:1;
im_z = -1:0.01:1;
% % use meshgrid() to get matrices of (re_z,im_z) grid points
% % that f(z) and f(1/z) will be evaluated at:
[re_z,im_z] = meshgrid(re_z,im_z);
% % z values corresponding to those (re_z,im_z) points:
z = re_z + 1i*im_z;
% define the function f(z) in terms of its coefficients p:
p=[(0.6-0.7i) (-0.6000 + 0.0020i) (0.2449 + 0.0049i) (0.2000 + 0.0020i) (0.2 + 0.0010i)];
f_of_z_result = polyval(p,z);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p=[(0.6 + 0.7i) (-0.1500-0.0005i) (0.0408-0.0008i) (0.0500-0.0005i) (0.2-0.0010i)];
% evaluate f at 1/z:
f_of_1_over_z_result = polyval(p,1./z);
% plot the magnitude and phase of f(z) and f(1/z):
% (same as before)
figure();
%%%%%%%%%%%%%%%%%%%%%%%%%%%TOPLOT F(Z)
subplot(2,2,1)
surf(re_z,im_z,abs(f_of_z_result),'EdgeColor','none')
title('|f(z)|')
xlabel('Z_R')
ylabel('Z_I')
subplot(2,2,2)
surf(re_z,im_z,angle(f_of_z_result),'EdgeColor','none')
title('phase of f(z)')
xlabel('Z_R')
ylabel('Z_I')
% %%%%%%%%%%%%%%%%%TODEFINE F(1/Z)
subplot(2,2,3)
surf(re_z,im_z,abs(f_of_1_over_z_result),'EdgeColor','none')
title('|f(1/z)|')
xlabel('Z_R')
ylabel('Z_I')
subplot(2,2,4)
surf(re_z,im_z,angle(f_of_1_over_z_result),'EdgeColor','none')
title('phase of f(1/z)')
xlabel('Z_R')
ylabel('Z_I') 