How do i plot these kind of surfaces?
7 views (last 30 days)
Show older comments
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1466662/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1466667/image.png)
I'll be so grateful for any kind of help.
0 Comments
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 Comments
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]
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 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!