# Problem with the product of complex numbers

6 Ansichten (letzte 30 Tage)
clement am 24 Mai 2013
Hello,
I calculated the equivalent impedance of an RLC circuit, and I would like this one to be completely resistive (complex part equals to 0). So I declared my variables as 'syms' and I used the function 'solve' to obtain the equivalent impedance litterally like:
% syms R X Y Z
% Zeq=solve('(R+i*X)*(-i*Y)/(R+i*X-i*Y)=Z',Z)
The problem is that Matlab gives me a solution like this:
%Zeq =
% -(Y*(R + X*i)*i)/(R + X*i - Y*i)
But I would like something like: Zeq = A + i*B.
Could anyone help?
Thanks
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Jonathan Epperl am 24 Mai 2013
Probably simplify(Zeq) will do that.
##### 2 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Walter Roberson am 24 Mai 2013
expandsol = expand(sol);
A = real(expandsol);
B = imag(expandsol);

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Walter Roberson am 24 Mai 2013
You cannot do that unless you add the assumption that the variables are real-valued
syms R X Y Z real
Zeq = simplify(solve((R+i*X)*(-i*Y)/(R+i*X-i*Y)-(Z),Z));
A = simplify(real(Zeq));
B = simplify(imag(Zeq));
A + B*i
##### 8 Kommentare7 ältere Kommentare anzeigen7 ältere Kommentare ausblenden
Jonathan Epperl am 25 Mai 2013
I see, I didn't know that -- so A-50 is the more robust syntax...

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by