Intersection of plane and line.

9 views (last 30 days)
what is the code to find the intersection of the plane x + 2y + 3z = 4 and line (x, y, z) = (2,4,6) + t(1,1,1)?

Accepted Answer

Star Strider
Star Strider on 9 Nov 2017
One approach:
syms x y z t
% x + 2y + 3z = 4 and line (x, y, z) = (2,4,6) + t(1,1,1)
xl = 2 + t;
yl = 4 + t;
zl = 6 + t;
Eqn = x + 2*y + 3*z == 4;
Eqn = subs(Eqn, {x y z},{xl yl zl});
t = solve(Eqn, t)
Then, substitute back into the ‘line’ equations for ‘xl’, ‘yl’, and ‘zl’.
  2 Comments
Stephanie Ciobanu
Stephanie Ciobanu on 9 Nov 2017
it won't print anything
Star Strider
Star Strider on 9 Nov 2017
It gave me:
t =
-4
in R2017b. This would yield:
xl = -2
yl = 0
zl = +2
Be sure you don’t have a semicolon at the end of the solve call line. That will suppress the output to the Command Window.

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!