% taken from MATLAB Function Reference
%
% $Revision: 1.12 by M.Miccio $  $Date: Oct. 21, 2010
%
% Phase angle of a Complex Number

% Description
% teta = angle(Z) returns the phase angles, in radians, for each element of complex array Z. 
% The angles lie between +/- PI (greek). 
% For complex Z, 
%               the magnitude R is given by             R = abs(Z)
%               and the phase angle theta is given by   theta = angle(Z)

disp (' ');
disp (' This m-file uses the function')
disp ('           angle(Z)')
disp (' that returns the phase, in radians between +/- PI, for each element of complex vector Z.')
disp (' ');
disp (' Example:')

Z = [ 1 + 1i   -1 + 1i   -1 - 1i   1 - 1i];
disp (Z')
teta = angle(Z) % angle calculation

disp (' Then the m-file converts the phase angles in degrees')
disp (' ');
teta = teta/pi*180

disp (' ');
disp (' ... the end !')