8
D. Rocchesso: Sound Processing
Discrete Fourier Transform
DFT
bins
% script that visualizes the effects of
% sampling and windowing
global_decl;
platform('octave'); %put either 'octave' or 'matlab'
a = - 10.0; b = 100;
s0 = a + i * b;
t = [0:0.001:1];
y = exp(s0*t); % complex exponential
subplot(2,2,1);
plot(t,real(y));
eval(mygridon);
title('Exponentially-decayed sinusoid');
xlabel('t [s]'); ylabel('y');
eval(myreplot);
pause;
f = [0:0.1:100];
Y = 1 ./ (i * 2 * pi * f - s0*ones(size(f)));
% closed-form
Fourier transform
subplot(2,2,2); plot(f, 20*log10(abs(Y)), '-');
title('Frequency response of a damped sinusoid');
xlabel('f [Hz]'); ylabel('|Y| [dB]');
hold on;
Fs = 50;
Ysamp = 1 ./ (1 - exp(s0/Fs) * exp(- i*2*pi*f/Fs)) / Fs;
% closed-form Fourier transform of the sampled signal
plot(f,20*log10(abs(Ysamp)),'--');
n = [0:6];
y = exp(s0*n/Fs);
Ysampw = y * exp(-i*2*pi/Fs*n'*f) / Fs;
% Fourier transform of the windowed signal
% obtained by vector-matrix multiply
plot(f,20*log10(abs(Ysampw)),'-.');
hold off;
eval(myreplot);
###
Finally, we define the Discrete Fourier Transform (DFT) as the collection
of N samples of the DTFT of a discrete-time signal windowed by a length-N
rectangular window. The frequency sampling points (called bins) are equally
spaced between 0 and F
s
according to the formula
f
k
=
kF
s
N
.
(18)
Therefore, the DFT is given by
Y (k) =
N -1
n=0
y(n)e
-j
2
N
kn
, k = [0 . . . N - 1] .
(19)
The DFT can also be expressed in matrix form. Just consider y(n) and Y (k) as
elements of two N -component vectors y and Y related by
Y = Fy ,
(20)
Next Page >>
<< Previous Page