MATLAB: Poor symbolic treatment of complex fraction

complexsymbolic

Hello.
I have been trying to solve with the symbolic toolbox (R2016a) a simple problem from circuit theory in frequency domain. Symbolic toolbox have not been able to find a decent form for the modulus of a complex fraction. Here you see an example
syms I I1 I2 I3 V
syms w C L Gpp real
assume( w>0);
assume( C>0);
assume( L > 0);
assume( Gpp>0);
expr = (I*L*w)/(C*L*w^2*1i + Gpp*L*w - 1i)
abs( expr)
The result found by the symbolic toolbox is
ans = (L*w*abs(I))/abs(C*L*w^2*1i + Gpp*L*w - 1i)
Is there a way to get something more elaborated, like
(L*w*abs(I))/sqrt( (C*L*w^2-1)^2 + (Gpp*L*w)^2 )
Regards
Carlos

Best Answer

syms I I1 I2 I3 V
syms w C L Gpp real
assume( w>0);
assume( C>0);
assume( L > 0);
assume( Gpp>0);
expr = (I*L*w)/(C*L*w^2*1i + Gpp*L*w - 1i) ;
a = abs( expr) ;
rewrite(a,'sqrt')