sam_rox
sam_rox

Reputation: 747

Drawing a curve on a 3-D surface graph

I have created a surface graph in MATLAB which I have projected on to X-Y 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?

enter image description here

Upvotes: 1

Views: 189

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112769

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

enter image description here

Upvotes: 1

Related Questions