1) Definition
The discrete-time Fourier transform (DTFT) is the equivalent of the Fourier transform for discrete time-series. With the DTFT, the signal is discrete in time and continouos in frequency. The DTFT is defined as
where $\omega$ is the angular velocity, $n$ is the time index, and $\sqrt{-1} = i$.
2) Step-by-step example: Windowed cosine function
1) We define the windowed cosine function as
where $w(n)$ is a rectangular window defined as
2) Transform $w(n)$ and $\cos(\omega_0 n)$ into the frequency using the DTFT
and
3) Derive the expression of $X(\omega)$
where $\ast$ is the convolution operator. As $\ast$ is a linear operator we may further reduce the expression to
Hence the DTFT of a windowed cosine, is a frequency shifted sinc-function by $\omega_0$ that repeats itself with a periodicity of $2\pi$.
3) Step-by-step practical example: Windowed cosine function
1) We define the windowed cosine function as
where $\omega_0$ is e.g. $\frac{\pi}{4}$ $w(n)$ is a rectangular window defined as
Therefore, $x(n)$ may be expressed as
2) Compute the DTFT in your desired frequency range e.g. $\omega \in [-4\pi,4\pi]$ as
4) MATLAB code
clc, clear, close all
% Generate example signal
N = 50;
n = (-N:N)';
omega0 = pi/4;
x = sum(cos(omega0.*n),2);
omega = -4*pi:0.001:4*pi;
% Step 1 + 2
for k = 1:length(omega)
X(k,1) = sum((x).*exp(-1j*omega(k)*n),1);
end
% Plot the DTFT
plot(omega,real(X))
grid, xlabel('\omega [rad/s]'),ylabel('Amplitude')
xticks([-4*pi -3*pi -2*pi -pi 0 pi 2*pi 3*pi 4*pi])
xticklabels({'-4\pi','-3\pi','-2\pi','-\pi','0','\pi','2\pi','3\pi','4\pi'})
xlim([-4*pi 4*pi])
and here is the plot generated by the MATLAB code:
Leave a comment