MATLAB: Find equation of plane intersect

MATLAB

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!

Best Answer

Ok, first, the solution set is NOT a line. It is a curve, that lives in the (x,y) plane. Next, There is NO plane of intersection.
Before we try to find any kind of a solution, plot things. How? Use a contour plot. Contour plots are greatly underappreciated things. Another option that is just as good is to use fimplicit, which will give you the same capability.
syms x y
f = x + y - x*log(y);
For any real solution to exist, we will need to stay away from negative values of y given the log. What kind of bounds would there be on x? Let me look at a plot first.
fimplicit(fun,[-20,20,0,20]);
grid on
xlabel X
ylabel Y
I would note the importance of a plot here, to help us to realize there are two branches to the solution set. As well, we need to recognize this is an implicit and multi-valued relationship, where for SOME values of x, there are apparently two possible choices for y that satisfy the relation.
Now, it is time to revisit the problem itself. If we have
x*log(y) = x+y
then we can solve for x, as a function of y. Thus
x*(log(y) - 1) = y
and therefore
x = y/(log(y) - 1)
Chose any value for y that is greater than 0, and a single value of x will result. However, we cannot go in the other direction, since there are clearly some values of x that would yield two solutions for y. As well, there are some values for x such that no real solutions exist. Thus for x > 0, but less than roughly 7, there is no real value of y that produces a valid solution.
Sadly, I'm afraid you cannot do something significantly simpler than I have done here. That is the "equation" of the intersection. The equation you want to find is a vaguely hyperbolic thing.
I suppose you could flip the axes.
funy_x = @(y,x) x + y - x.*log(y)
fimplicit(funy_x,[0,20,-20,20])
xlabel y
ylabel x
grid on
What else? Where does the singularity lie? That is, what value of y produces a singularity? This is easy. That must arise when
log(y) -1 == 0
or
y = exp(1)
Related Question