Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

angle

Description

angle is a MATLAB® function.

Examples

collapse all

Generate a signal that consists of two sinusoids of frequencies 15 Hz and 40 Hz. The signal is sampled at 100 Hz for one second.

fs = 100;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*15*t) + sin(2*pi*40*t);

Compute the discrete Fourier transform of the signal. Find the phase of the transform and plot it as a function of frequency.

y = fft(x);
phs = unwrap(angle(y));
ly = length(y);
f = (0:ly-1)/ly*fs;

plot(f,phs/pi)
xlabel 'Frequency (Hz)'
ylabel 'Phase / \pi'
grid

Introduced before R2006a

Was this topic helpful?