| Signal Processing Toolbox | Search  Help Desk |
| angle | Examples See Also |
Syntax
p = angle(h)
Description
p = angle(h)
returns the phase angles, in radians, of the elements of complex vector or array h. The phase angles lie between -
and
.
For complex sequence h = x + iy = meip, the magnitude and phase are given by
m = abs(h) p = angle(h)To convert to the original
h from its magnitude and phase:
i = sqrt(-1) h = m.The*exp(i*p)
angle function is part of the standard MATLAB language.
Example
Calculate the phase of the FFT of a sequence:t = (0:99)/100; % time vector x = sin(2Plot the phase:*pi*15*t) + sin(2*pi*40*t); % signal y = fft(x); % compute DFT of x p = unwrap(angle(y)); % phase
f = (0:length(y)-1)'/length(y)*100; % frequency vector
plot(f,p)
Algorithm
angle can be expressed as:
angle(x) = imag(log(x)) = atan2(imag(x),real(x))
See Also
abs |
Absolute value (magnitude). |