简体   繁体   中英

How to plot a 3D surface with a circle in it?

I have a rational polynomial function. I find zeros of numerator and denominator of it. Now I want to draw this function and I do it with meshgrid and mesh command in matlab. How can I draw a circle in this shape? I add my result figure at first and second figure is an image that I want to be like that( draw red circle).

我的情节

我想要的情节:(

Create x and y for your circle:

r = 1;
theta = 0:0.1:2*pi;
x = r*cos(theta);
y = r*sin(theta);

Get the value of your function at the x and y's and plot a line in 3D with the values:

z = f(x,y);
plot3(x,y,z);

The final result may have some artefacts where the line crosses in and out of the surface. If you are not so concerned about the accuracy in the plot add a very small value to z to "lift" it above the surface.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM