how to label the axes when I want to plot the complex function in the case of( the phase of f(1/z) )?

4 次查看(过去 30 天)
I have received the following great answer for this question (how to plot the function f(1/z) in matlab where z is any complex numer)
% define the function f(z) in terms of its coefficients p:
% f(z) = z^2-2*z+1
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]; % polynomial coefficients p instead of anonymous function f
% evaluate f over all z in ([-1,1],[-1,1]):
f_of_z_result = polyval(p,z);
% 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();
subplot(2,2,1)
surf(re_z,im_z,abs(f_of_z_result),'EdgeColor','none')
title('|f(z)|')
subplot(2,2,2)
surf(re_z,im_z,angle(f_of_z_result),'EdgeColor','none')
title('phase of f(z)')
subplot(2,2,3)
surf(re_z,im_z,abs(f_of_1_over_z_result),'EdgeColor','none')
title('|f(1/z)|')
subplot(2,2,4)
surf(re_z,im_z,angle(f_of_1_over_z_result),'EdgeColor','none')
title('phase of f(1/z)')
My qestion now is how to label the real and imagenary axes and the axis representes phase of f(1/z)?
how can I use the same lable in (the phase of f(1/z)) and |f(1/z)|?
I maen the phase means the angle how lable its axese with numbers
re_z=-1:0.01:1;
im_z=-1:0.01:1;?
I will appriciate any help.
  1 个评论
dpb
dpb 2022-4-28
编辑:dpb 2022-4-28
Well, in the complex plane the Re and Im axes aren't the phase angles; the phase angle has a value at every point in the plane that you can compute via the function angle(z)
The four corners of your surface plot are at
Z=[complex(-1, 1) complex( 1, 1);
complex(-1,-1) complex( 1,-1)];
and the angles at those locations are then
>> rad2deg(angle(Z))
ans =
135 45
-135 -45
>>
I guess you can do the above for the locations shown on the axes as best representation as can do on the two axes...

请先登录,再进行评论。

回答(1 个)

SAI SRUJAN
SAI SRUJAN 2023-10-12
Hi Aisha Mohamed,
I understand that you are facing an issue labeling the real and imaginary axes.
You can follow the below given example to resolve the issue.
x = linspace(-10, 10, 100);
y = linspace(-10, 10, 100);
[X, Y] = meshgrid(x, y);
Z = X.^2 + Y.^2;
surf(X, Y, Z);
xlabel('Real Axis');
ylabel('Imaginary Axis');
zlabel('Z');
title('Surface Plot');
You can use "xlabel" and "ylabel" MATLAB functions to label the real and imaginary axes.
I have provided links to relevant documentation which gives you further insight.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by