How can I expand a complex number in Real + i*Imaginary parts using symbolic variables?

3 ビュー (過去 30 日間)
Henrique Rachid
Henrique Rachid 2018 年 1 月 24 日
回答済み: Nicolas Schmit 2018 年 1 月 25 日
I'm trying to find an expression that contains both Real and Imaginary parts for further use in a nonlinear equation system. Please, could anyone check my script and tell me if there's another way to do it?
Thanks.
if true
syms X1 X2 R1 R2 Rm Xm real;
Zc = expand(R2+X2*1i);
Zb = expand((Zc*Rm)/(Zc+Rm));
Za = expand((Zb*Xm*1i)/(Zb+Xm*1i));
Zeq = expand((Za + R1 + X1*1i));
Req = vpa(real(Zeq),6)
Xeq = vpa(imag(Zeq),6)
end

回答 (1 件)

Nicolas Schmit
Nicolas Schmit 2018 年 1 月 25 日
Not sure if it is what you are trying to do, but you can extract the real and imaginary parts of an expression using the real() and imag() functions.

カテゴリ

Help Center および File ExchangeNumbers and Precision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by