Plotting three planes and their intersections
Show older comments
I have three planes described the by the cartesian equations.

I want to plot the planes and their intersections.
I have written the following script which plots the planes and their point of intersection.
% premier plan
x1 = 0:0.5:10; x2 = 0:0.5:3;
[X Y] = meshgrid(x1,x2);
Z = 3-Y-(3/10)*X;
H1 = surf(X,Y,Z);
set(H1,'facecolor', 'r','FaceAlpha',0.3, 'EdgeColor' ,'none')
hold on
% deuxième plan
x1 = 0:0.5:2; x2 = 0:0.5:20;
[X Y] = meshgrid(x1,x2);
Z = 2-X-(1/10)*Y;
H2 = surf(X,Y,Z);
set(H2,'facecolor', 'b','FaceAlpha',0.3, 'EdgeColor','none')
% troisième plan
x1 = 0:0.5:5; x2 = 0:0.5:10;
[X Y] = meshgrid(x1,x2);
Z = 0.5*(1-(1/5)*X-(1/10)*Y);
H3 = surf(X,Y,Z);
set(H3,'facecolor', 'g','FaceAlpha',0.3, 'EdgeColor' ,'none')
% point d'intersection
A = [1/10, 1/3, 1/3; 1/2, 1/20, 1/2; 1/5, 1/10, 1/0.5]; C = [1, 1, 1]';
x_sol = A\C;
plot3(x_sol(1), x_sol(2), x_sol(3), 'k.', 'MarkerSize', 30)
xlabel('x'), ylabel('y'), zlabel('z')
axis square, grid on, grid minor, box on
xlabel('x_1'),ylabel('x_2'),zlabel('x_3')
set(gca,'FontSize',16)
xlim([0 10]) , ylim([0 20]), zlim([0 3])
set(gca, 'Xdir', 'reverse', 'YDir', 'reverse')
How can I plot the lines of intersection of the planes?

Thank you very much in advance.
Accepted Answer
More Answers (1)
Matt J
on 17 Feb 2022
0 votes
First, you must compute the lines of intersection. Then you can use the line() command to add them to your plot.
Categories
Find more on Surfaces, Volumes, and Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
