# How do i plot these kind of surfaces?

3 views (last 30 days)
simran on 28 Aug 2023
Commented: simran on 2 Sep 2023
I want to plot a surface with coordinates (re(x_1(z)),im(x_2(z)),2*Im(x_3(z));
where x_1(z),x_2(z),x_3(z) are any functions of z and 'z' is a complex variable such that |z|<1, i.e, z belongs to unit disk. Also,"Re" and "Im" stands for real and imaginary part of the respective complex function.
i want to plot surfaces like this in MATLAB, as done in the above tool. Also, i wanted to understand the significance of the above theta min and theta max setup. why not just put 0 to 2*pi ? How will we know what to set pi/24 or pi/32? so, out of curiosity hen i put 0 to 2*pi, the picture looks absurd like this as shown in the picture attached below? Please tell me how to draw these in MATLAB (with better colors) and the significance of theta min and theta max.
I'll be so grateful for any kind of help.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

Dyuman Joshi on 29 Aug 2023
It shows in the image to take the real part of the functions, but your description says something different.
The code below is according to the image as reference -
"Please tell me how to draw these in MATLAB (with better colors)"
You figured out using fsurf, for colors, experiment with colormap, choose the one you like the most.
syms z r theta
X(z) = real(-i/2*log((1+z*i)/(1-z*i)));
Y(z) = real(-i/2*log((1+z)/(1-z)));
Z(z) = real(1/2*log((1+z^2)/(1-z^2)));
X(r,theta)=subs(X,z,r*exp(1i*theta));
Y(r,theta)=subs(Y,z,r*exp(1i*theta));
Z(r,theta)=subs(Z,z,r*exp(1i*theta));
fsurf(X,Y,Z,[0 1 pi/24 2*pi+pi/24],'MeshDensity',150,'LineStyle','none')
colormap(cool)
%Adjust x, y and z axis limits according to the reference image
axis([-1 1 -1 1 -1 1])
"Also, i wanted to understand the significance of the above theta min and theta max setup."
The values provided are used to calculate the values of X, Y and Z functions and then the values are used to plot the function. The plot will be according to the values provided, if no values are provided, default values are used.
"How will we know what to set pi/24 or pi/32?"
You can choose anyvalue, as using [value 2*pi+value] is equivalent to using [0 2*pi]. (I don't know the reason why the image you got for [0 2*pi] is so different from [pi/24 2*pi+pi/24])
See the below plot and compare it to the above plot -
figure
fsurf(X,Y,Z,[0 1 0 2*pi],'MeshDensity',150,'LineStyle','none')
colormap(cool)
axis([-1 1 -1 1 -1 1])
You can also compare the data, which you can get from the handle of fsurf().
##### 3 CommentsShow 1 older commentHide 1 older comment
Dyuman Joshi on 30 Aug 2023
"You've just pasted my code with just axis command in addition."
No, I have made other changes and gave explainations as well, which you have overlooked.
"And it doesn't answer my whole question about what role does theta play"
I did. You seem to have skipped over it -
"Also, i wanted to understand the significance of the above theta min and theta max setup."
The values provided are used to calculate the values of X, Y and Z functions and then the values are used to plot the function. The plot will be according to the values provided, if no values are provided, default values are used.
"why the figure had such drastic changes with setting theta 0 to 2pi?"
I don't know about the software you used to get that figure, but it in MATLAB both figures are the same. Once again, read my answer.
"And how will I know what thetas to set pi/24 or pi/42 or pi/108?"
I answered this as well -
"How will we know what to set pi/24 or pi/32?"
You can choose anyvalue, as using [value 2*pi+value] is equivalent to using [0 2*pi]
simran on 2 Sep 2023
ok, Thanks!

Sign in to comment.

### More Answers (1)

Abderrahim. B on 28 Aug 2023
Hi!
You may want to try surf function, and customize the plot to get a similar one to what you have posted. If you want to plot and interact with your plot use MATLAB app designer.
Hope this helps
-AB
##### 4 CommentsShow 2 older commentsHide 2 older comments
simran on 28 Aug 2023
Edited: Voss on 28 Aug 2023
I had x_1,x_2, x_3 as symbolic functions of z. Then i put the following, I'm not sure if it's correct. Plus I don't know what theta to set as min max so that it shows a better picture. What does that do?
syms r; syms theta;
x_1(r,theta)=subs(x_1,z,r*exp(1i*theta))
x_2(r,theta)=subs(x_2,z,r*exp(1i*theta))
x_3(r,theta)=subs(x_3,z,r*exp(1i*theta))
fsurf(real(x_1),imag(x_2),2*imag(x_3),[0 0.9999 pi/24 2*pi+pi/24],'MeshDensity',200,'ShowContours','on')
Dyuman Joshi on 29 Aug 2023
@simran please check my answer.

Sign in to comment.

### Categories

Find more on Surface and Mesh Plots in Help Center and File Exchange

R2023a

### Community Treasure Hunt

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

Start Hunting!