How can I use matlab to find the solution of an equation when equal to zero using variables without substituting with numbers?

I want to find how can I use matlab to find the solution of an equation when equal to zero using variables without substituting with numbers?
for example if the equation is : (x^2) - (y^2) = 0
the answer will be (x=y)

 Akzeptierte Antwort

That is what the 'solve' function of the Symbolic Toolbox endeavors to do. It is not always successful, but it capable of some remarkable results.

3 Kommentare

Thank you very much for your answer, I tried to use 'solve' but i didn't give me the expected answer, as you see below:
syms u v [solv, solu] = solve([u^2 - v^2 == 0], [v, u])
solv =
0
solu =
0
while I expected to give me answer (x=y)
Actually it worked with one variable only:
syms a b c x y sol = solve(x^2 - y^2== 0)
sol =
y
-y
but how can i use it with 2 variables ?
You just have to ask it in a way it understands:
syms u v
v = solve([u^2 - v^2 == 0], v)
produces:
v =
u
-u

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by