Problem with the product of complex numbers
2 views (last 30 days)
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
The problem is that Matlab gives me a solution like this:
% -(Y*(R + X*i)*i)/(R + X*i - Y*i)
But I would like something like: Zeq = A + i*B.
Could anyone help?
More Answers (1)
Walter Roberson on 24 May 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