MATLAB: Abs and angle of complex number with symbolic object

absangle sym

Hi,
If r=sym('a')*exp(j*sym('b')) is a symbolic object, and
1. if I write abs(r), I get abs(a)…..I need get only "a" without abs
2. if I write angle(r), I get error
??? Undefined function or method 'atan2' for input arguments of type 'sym'.
Error in ==> angle at 14 p = atan2(imag(h), real(h));
Can you help me please? How can I solve this?

Best Answer

There is no "complex argument" function for symbolic variables exposed at the MATLAB level. You can, though, define
arg = @(V) feval(symengine, 'arg', V);
Related Question