solve 2 unknowns using one complex equation
Afficher commentaires plus anciens
usually, to solve 2 unknowns, it require at least 2 or more equations. but if the equation is complex, then one equation is sufficient since can compare the real and imaginary part. for example
3+2i = (x+2y+1)+(2x-y-3)i
if want to solve for x and y a simple solve function as shown can be written.
T=3+2i;
syms x y;
P=-real(T)+ (x+2*y+1);
Q=-imag(T)+ (2*x-y-3);
R=solve(P,Q);
X=R.x
Y=R.y
I am now trying to tackle a much more complex equation that involves x and y. and its near impossible to separate the terms into real and imaginary part.
so i'm hoping to do something like this
syms x y;
P=-1*real(T)+ real(%a complicated eq relating x&y%);
Q=-1*imag(T)+ imag(%a complicated eq relating x&y%);
R=solve(P,Q);
but i keep getting error. i think the syntax is incorrect. is there a way to get this working? please share your thoughts one this.
any suggestions are highly appreciated.
1 commentaire
Walter Roberson
le 4 Juin 2012
What error message do you get?
Réponses (0)
Catégories
En savoir plus sur Numeric Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!