Discrete Fourier transform
Y = fft(X)
Y = fft(X,n)
Y = fft(X,,dim)
Y = fft(X,n,dim)
The functions Y=fft(x) and y=ifft(X) implement the transform and inversetransform pair given for vectors of length by:
is an th root of unity.
Y = fft(X) returns the discrete Fourier transform (DFT) of vector X, computed with a fast Fourier transform(FFT) algorithm.
If X is a matrix, fft returns the Fourier transform of each column of the matrix.
If X is a multidimensional array, fft operates on the first nonsingleton dimension.
Y = fft(X,n)returns the n-point DFT. If the length of X is less than n, X is padded with trailing zeros to length n. If the length of X is greater than n, the sequence X is truncated. When X is a matrix, the lengthof the columns are adjusted in the same manner.
Y = fft(X,,dim) and Y = fft(X,n,dim) applies the FFT operation across the dimension dim.
A common use of Fourier transforms is to find thefrequency components of a signal buried in a noisy time domain signal. Consider data sampled at 1000 Hz. Form a signal containing a 50 Hz sinusoid of amplitude 0.7 and 120 Hz sinusoid of amplitude 1and corrupt it with some zero-mean random noise:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sample time
L =1000; % Length of signal
t = (0:L-1)*T; % Time vector
% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid
x =0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
y = x + 2*randn(size(t)); % Sinusoids plus noise
title('Signal Corrupted with Zero-MeanRandom Noise')
It is difficult to identify the frequency components by looking at the original signal. Converting to the frequency domain, the discrete...