Working with complex numbers in the Symbolic Math Toolbox. Why does angle(A) returns atan2(sin(alpha),cos(alpha)) instead of just alpha?
Mostrar comentarios más antiguos
%% 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?

Respuesta aceptada
Más respuestas (1)
Asad (Mehrzad) Khoddam
el 17 de Sept. de 2020
if you want to find the numerical value of alpha, one solution is to use double function:
double(angle(A))
Categorías
Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








