find equation of plane intersect
Show older comments
hello,
I'm trying to find the equation of the line where two planes intersect. basically, I'm trying to find x as function of y or the opposite which solves the following equation:
I've tried using the following code:
syms x y
ekv1=x+y==0
ekv2=x*log(y)==0
xyz = solve([ekv1, ekv2])
x = xyz.x
y = xyz.y
but it gives me numbers. this is the output:
xyz =
struct with fields:
x: [2×1 sym]
y: [2×1 sym]
x =
0
-1
y =
0
1
what did I do wrong? or perhaps I just don't know how to read it?
Thank you very much!
Accepted Answer
More Answers (1)
Ameer Hamza
on 7 Apr 2020
See this code
syms x y
ekv1=x+y;
ekv2=x*log(y);
X = solve(ekv1==ekv2,x);
surf1 = matlabFunction(ekv1, 'Vars', [x y]);
surf2 = matlabFunction(ekv2, 'Vars', [x y]);
intersect_x = matlabFunction(X);
x = -5:0.1:5;
y = 0:0.1:5;
[X_grid,Y_grid] = meshgrid(-5:0.1:5, 0:0.1:5);
Z1 = surf1(X_grid,Y_grid);
Z2 = surf2(X_grid,Y_grid);
figure;
ax = axes();
hold(ax);
view(3);
grid on
mesh(X_grid,Y_grid,Z1)
mesh(X_grid,Y_grid,Z2)
y = 0:0.01:2;
plot3(intersect_x(y), y, surf1(intersect_x(y), y), 'r', 'LineWidth',2);
xlim([-5 5]);
ylim([0 5]);
1 Comment
Elinor Ginzburg
on 8 Apr 2020
Categories
Find more on Language Fundamentals 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!
