Code covered by the BSD License  

Highlights from
Phasor/Polar Data Type

from Phasor/Polar Data Type by Timothy Felty
Implementation of Phasor/Polar data type and associated functions

p=comp2phas(compmat)
function p=comp2phas(compmat)
% Returns the phasor representation of a complex quantity
% inverse of phas2rect with one output and optional input 'imag'
% inverse of double with optional input 'vect'
% will return the same phasors but the angle is the representation chosen by atan2 and 
% not necessarily the one originally had if converting back and forth
% part of phasor/polar class v.3
% realcompmat=real(compmat);
% imagcompmat=imag(compmat);
pmag=abs(compmat);
pangle=angle(compmat)*180/pi;
pangle=mod(pangle,360);
p=phasor(pmag,pangle);

Contact us at files@mathworks.com