Working with complex numbers in the Symbolic Math Toolbox. Why does angle(A) returns atan2(sin(alpha),cos(alpha)) instead of just alpha?
Show older comments
%% Complex number using TRIGONOMETRIC form
% Let's define A as a complex number in polar form, with magnitude M and angle alpha
M = sym('M',{'real','positive'}); % magnitude
alpha = sym('alpha','real'); % angle
assume(alpha>-pi & alpha<pi)
A = M*(cos(alpha) + i*sin(alpha)); % complex number in polar form
% Now, I would expect abs(A) to return M. It does not.
abs(A)
% But, using rewrite and combine, I can get the it to return M
combine(rewrite(abs(A), 'sqrt'), 'sincos')
% Similarly, I would expect the angle(A) to return alpha, but instead we get atan2(sin(alpha), cos(alpha)).
angle(A)
% I tried the simplify and rewrite function, but I could not get the angle(A) to return alpha. Is there a way around this?

Accepted Answer
More Answers (1)
Asad (Mehrzad) Khoddam
on 17 Sep 2020
if you want to find the numerical value of alpha, one solution is to use double function:
double(angle(A))
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







