Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Plot the intersection of two 3d plot
Replies: 0

 Triet Posts: 3 Registered: 12/29/12
Plot the intersection of two 3d plot
Posted: May 20, 2013 9:51 AM

I have two function z=f(x,y) and z=g(x,y) and I have plotted it but how can I plot the curve of intersection between those two?
And can you check my script below as well? Feel free to critic and edit it!
My program:

syms x y z;
g=@(x,y) -x-y-6;
..... (There're more things here but it doesn't matter).....
clf
hold on;
axis square;
t=-100:100;
funplot1=a.*sqrt(1+((t.^2)/(b.^2)));
[d1, d2, d3] =cylinder(funplot1);
h1=surf(d1,d2,d3,'LineStyle','-','FaceLighting','phong','EdgeAlpha',0.2,'FaceAlpha',0.4,'EdgeColor','red','FaceColor','yellow')
xr=-100:100;
yr=-100:100;
gz=ones(size(xr,2),size(yr,2));
for i=1:size(xr)
for j=1:size(yr)
end
end
for i=1:size(xr,2)
for j=1:size(yr,2)
gz(i,j)=f(xr(i),yr(j));
end
end
h2=surf(xr,yr,gz,'LineStyle','-','FaceLighting','phong','EdgeAlpha',0.2,'FaceAlpha',0.4,'EdgeColor','green','FaceColor','blue');
....(The intersection plot code should be here)...
end