Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Plot the intersection of two 3d plot

Subject: Plot the intersection of two 3d plot

From: Triet

Date: 20 May, 2013 13:51:10

Message: 1 of 1

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

I'm a newbie in Matlab so please help me!
Sorry for my poor English!
Thanks in advance!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us