Solving an equation with two variables, why is one being set to zero?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Alex Gordon
il 28 Set 2017
Risposto: John D'Errico
il 28 Set 2017
My code is as follows:
syms x y
[xRoot, yRoot] = solve((y-1).^2 + (x-1).^2 == floor(sqrt(2)-1).^2,y,x)
The output of this should (hopefully) be xRoot = 1, yRoot = 1 however in the actual output yRoot is being set to zero and xRoot is 1+-i.
How can I stop yRoot being set to zero and therefore not get complex roots for x?
Thanks.
0 Commenti
Risposta accettata
John D'Errico
il 28 Set 2017
There are multiple solutions here. This will help in your case though.
syms x y real
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!