This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.



angle is a MATLAB® function.


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;

xlabel 'Frequency (Hz)'
ylabel 'Phase / \pi'

Introduced before R2006a

Was this topic helpful?