# 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일)
Aisha Mohamed . 2022년 4월 28일
답변: SAI SRUJAN . 2023년 10월 12일
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이전 댓글 -1개 표시이전 댓글 -1개 숨기기
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
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 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에서 Labels and Annotations에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!