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

7 次查看(过去 30 天)
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')

回答(1 个)

SAI SRUJAN
SAI SRUJAN 2023-10-17
Hi Aisha Mohamed,
I understand that you are trying to grasp the concept of the phase of a complex function and its plotting techniques.
The phase of a complex function refers to the angle or argument of the complex number that the function evaluates at each point in the complex plane. It represents the direction or orientation of the complex number in the complex plane.
The phase an be negative as it is measured in radians and can take values from -π to π. It represents the angle that the complex number makes with the positive side of the x-axis in the complex plane.The MATLAB function "angle" can be used to find phase of a complex number.
To plot phase of a function you can use "surf" function in MATLAB.
You can follow the below given example to get a better understanding of the issue.
re_z=-1:0.01:1;
im_z=-1:0.01:1;
[re_z,im_z]=meshgrid(re_z,im_z);
z=re_z+1i*im_z;
p = [1 -2 1];
f_of_z_result = polyval(p,z);
figure();
surf(re_z,im_z,angle(f_of_z_result),'EdgeColor','none')
title('phase of f(z)')
You can refer to the below documentation to understand more about "surf” and "angle" in MATLAB.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by