简体   繁体   中英

Drawing a curve on a 3-D surface graph

I have created a surface graph in MATLAB which I have projected on to XY axis. I want to find the equation of a line that follows the yellow region in the following graph. That is I want to find the equation of a curved line like the one displayed from the black curve.
Is there a way for me to draw a curved line on this surface graph and then obtain the equation of that curve.
If it is a line in MATLAB I think I can do it by Insert-> Line . Is there a similar way for me to draw a curve on the surface graph?

在此处输入图片说明

You can use contour . Note that, as per the documentation, you have to duplicate the value that defines the desired level:

x = linspace(0,pi,200);
y = linspace(0,pi/2,200);
z = bsxfun(@times, sin(x), sin(y.')); %'// example data
imagesc(z); %// plot image
hold on
value = .5; %// desired level
h = contour(z,[value value],'k'); %// plot contour for that level

在此处输入图片说明

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