Discrete Signal Processing (DSP):

Discrete Time Fourier Transformation (DTFT)

Table of Contents





1. From DFT to DTFT

The Discrete-Time Fourier Transform (DTFT) provides a frequency-domain representation for infinite-length discrete-time signals and systems. While the DFT is computationally convenient for finite-length signals, the DTFT is conceptually useful for analyzing infinite-duration signals.


1.1. The Centered DFT

Since both the time-domain signal $x[n]$ and its DFT $X[k]$ are periodic with period $N$, it is often convenient to center the range of indices around zero:


$$ -\frac{N}{2} \leq n, k \leq \frac{N}{2} - 1 $$

The centered (unnormalized) forward and inverse DFT formulas become:


$$ \begin{aligned} X_u[k] &= \sum_{n=-\frac{N}{2}}^{\frac{N}{2}-1} x[n] \, e^{-j \frac{2\pi}{N}kn} \\\\ x[n] &= \frac{1}{N} \sum_{k=-\frac{N}{2}}^{\frac{N}{2}-1} X[k] \, e^{j \frac{2\pi}{N}kn} \end{aligned} $$

1.2. Toward the DTFT: Taking the Limit

To derive the DTFT, we examine the behavior of the DFT as $N \rightarrow \infty$:

  • The sum becomes infinite in length.
  • $x[n]$ becomes aperiodic.
  • The frequency variable becomes continuous:

$$ \omega_k = \frac{2\pi}{N}k, \qquad -\pi \leq \omega_k < \pi $$

Key fact: No matter how large $N$ grows, the frequencies of the DFT sinusoids always lie within the fixed interval:



1.3. Discrete-Time Fourier Transform (DTFT)


Forward DTFT

In the limit as $N \rightarrow \infty$, the DFT becomes the DTFT:


$$ X(\omega) = \sum_{n=-\infty}^{\infty} x[n] \, e^{-j\omega n}, \qquad -\pi \leq \omega < \pi $$
  • This defines the inner product between the signal $x[n]$ and the complex exponential $e^{j\omega n}$.

  • $X(\omega)$ measures the similarity of $x[n]$ to the sinusoid $e^{j\omega n}$.



Inverse DTFT

The corresponding inverse transform reconstructs $x[n]$ from $X(\omega)$:


$$ x[n] = \frac{1}{2\pi} \int_{-\pi}^{\pi} X(\omega) \, e^{j\omega n} \, d\omega $$
  • The signal $x[n]$ is expressed as an infinite linear combination of complex sinusoids weighted by $X(\omega)$.



The DTFT pair is:


$$ \begin{aligned} X(\omega) &= \sum_{n=-\infty}^{\infty} x[n] \, e^{-j\omega n}, \qquad -\pi \leq \omega < \pi \\\\ x[n] &= \frac{1}{2\pi} \int_{-\pi}^{\pi} X(\omega) \, e^{j\omega n} \, d\omega, \qquad n \in \mathbb{Z} \end{aligned} $$

This formulation extends the DFT to a continuous, aperiodic setting, providing a foundational tool for analyzing infinite-length signals and linear time-invariant (LTI) systems.







(MATLAB Code) DTFT

In [ ]:
%plot -s 560,300

% dtft from definition

n = 0:3;
x = [1 1 1 1];

N = 200;

w = [0:N-1]*2*pi/N;
Xdtft = 1*exp(-1j*w*0) + 1*exp(-1j*w*1) + 1*exp(-1j*w*2) + 1*exp(-1j*w*3);

plot(w/pi, abs(Xdtft))
xlabel('\omega in \pi unit', 'fontsize', 8),
title('DTFT in (0, 2\pi)', 'fontsize', 8)


(MATLAB Code) Centered DTFT

In [ ]:
k = [0:N/2-1 -N/2:-1];
w = k*2*pi/N;
ws = fftshift(w);
Xdtfts = fftshift(Xdtft);

plot(ws/pi, abs(Xdtfts))
xlabel('\omega in \pi unit', 'fontsize', 8),
title('DTFT in (-\pi, \pi)', 'fontsize', 8)

In [ ]:
x = [1,1,1,1];
N = length(x);

k = [0:N/2-1 -N/2:-1];
ks = fftshift(k);

X = dft(x,N);
Xs = fftshift(X);

stem(ks,abs(Xs),'filled'),
xlabel('freq in k','fontsize',8), ylabel('X[k]','fontsize',8),
xlim([-N/2,N/2]), hold on
c = [0 0.4470 0.7410];
plot(ws*N/(2*pi),abs(Xdtfts),'--', 'color', c), hold off

In [ ]:
x = [1,1,1,1,zeros(1,4)];
N = length(x);

k = [0:N/2-1 -N/2:-1];
ks = fftshift(k);

X = dft(x,N);
Xs = fftshift(X);

stem(ks,abs(Xs),'filled'),
xlabel('freq in k','fontsize',8), ylabel('X[k]','fontsize',8),
xlim([-N/2,N/2]), hold on
plot(ws*N/(2*pi),abs(Xdtfts),'--', 'color', c), hold off

In [ ]:
x = [1,1,1,1,zeros(1,12)];
N = length(x);

k = [0:N/2-1 -N/2:-1];
ks = fftshift(k);

X = dft(x,N);
Xs = fftshift(X);

stem(ks,abs(Xs),'filled'),
xlabel('freq in k'), ylabel('X[k]'), xlim([-N/2,N/2]), hold on
plot(ws*N/(2*pi),abs(Xdtfts),'--', 'color', c), hold off

In [ ]:
% DTFT using the output of FFT (or DFT)

x = [1,1,1,1,zeros(1,2^6-4)];
N = length(x);

k = [0:N/2-1 -N/2:-1];
ks = fftshift(k);

X = dft(x,N);
Xs = fftshift(X);

stem(ks,abs(Xs),'filled')
xlabel('freq in k'), ylabel('X[k]'), xlim([-N/2,N/2]), hold on
plot(ws*N/(2*pi),abs(Xdtfts),'--', 'color', c), hold off

In [ ]:
% DTFT using the output of FFT (or DFT)

x = [1,1,1,1,zeros(1,2^7-4)];
N = length(x);

k = [0:N/2-1 -N/2:-1];
ks = fftshift(k);

X = dft(x,N);
Xs = fftshift(X);

stem(ks,abs(Xs),'filled')
xlabel('freq in k'), ylabel('X[k]'), xlim([-N/2,N/2]), hold on
plot(ws*N/(2*pi),abs(Xdtfts),'--', 'color', c), hold off

2. DTFT

function X = dtft(x,n,w)
% X = dtft(x, n, w)
%
% X = DTFT values computed at w frequencies
% x = finite duration sequence over n (row vector)
% n = sample position vector
% w = frequency location vector (row vector)

X = exp(-1j*(w'*n))*x';

end

DTFT of the Impulse

The impulse signal contains all frequency components with equal weight.


$$ x[n] = \delta[n] \quad \longleftrightarrow \quad X(\omega) = \sum_{n=-\infty}^{\infty} \delta[n] e^{-j\omega n} = 1 $$
In [ ]:
%plot -s 560,420

[x, n] = impseq(0, -10, 10);
w = linspace(-1,1,2^10)*pi;

X = dtft(x,n,w);

subplot(2,1,1),
stem(n,x,'filled')
subplot(2,1,2),
plot(w/pi,abs(X),'linewidth',2), ylim([0, 1.3])
xlabel('Freq. in \pi units')


DTFT of $e^{j\omega_0 n}$


$$ e^{j\omega_0 n} \quad \longleftrightarrow \quad 2\pi \delta(\omega - \omega_0) $$

This follows from:


$$ \frac{1}{2\pi} \int_{-\pi}^{\pi} 2\pi \delta(\omega - \omega_0) e^{j\omega n}\, d\omega = e^{j\omega_0 n} $$

DTFT of the Unit Pulse

Let:


$$ p[n] = \begin{cases} 1 & -M \leq n \leq M \\ 0 & \text{otherwise} \end{cases} $$

Then the DTFT is:


$$ \begin{align*} P(\omega)\, &=\, \sum_{n=-\infty}^\infty \, p[n]\, e^{-j\omega n}\, =\, \sum_{n=-M}^M \,e^{-j\omega n}\, = \, \frac{e^{j\omega M}\, -\, e^{-j\omega (M+1)}}{1\, -\, e^{-j\omega}}\, \\&=\, \frac{e^{-j\omega /2}\left(e^{j\omega \frac{2M+1}{2}}\, -\, e^{-j\omega \frac{2M+1}{2}}\right)}{e^{-j\omega /2} \left(e^{j\omega /2}\, -\, e^{-j\omega /2}\right)}\, =\, \frac{2j\, \sin \left(\omega \frac{2M+1}{2} \right)}{2j\, \sin \left(\frac{\omega}{2} \right)}\\ &= \frac{ \sin \left(\omega \frac{2M+1}{2} \right)}{ \sin \left(\frac{\omega}{2} \right)} \end{align*}$$
In [ ]:
%plot -s 560,420

x = [1 1 1 1 1 1 1];
n = -3:3;
w = linspace(-2,2,2^10)*pi;

X = dtft(x,n,w);

xd = zeros(1,31);
nd = -15:15;
[y,ny] = sigadd(xd,nd,x,n);

subplot(2,1,1), stem(ny,y,'filled')
subplot(2,1,2), plot(w/pi,abs(X)), xlabel('Freq. in \pi units')


DTFT of a Triangle Function

Define the triangle function as the convolution of two pulses:


$$ t[n] = p[n] * p[n] $$

Then, in the frequency domain:


$$ T(\omega) = |P(\omega)|^2 = \left[\frac{\sin\left( \omega \frac{2M+1}{2} \right)}{\sin\left( \frac{\omega}{2} \right)}\right]^2 $$

This result shows that the triangle has stronger low-pass behavior than the rectangular pulse.


In [ ]:
%plot -s 560,420

x = [1 2 3 4 3 2 1];
n = -3:3;
w = linspace(-2,2,2^10)*pi;

X = dtft(x,n,w);

xd = zeros(1,31);
nd = -15:15;
[y,ny] = sigadd(xd,nd,x,n);

subplot(2,1,1), stem(ny,y,'filled')
subplot(2,1,2), plot(w/pi,abs(X)), xlabel('Freq. in \pi units')


DTFT of a One-Sided Exponential

Let:


$$ h[n] = \alpha^n u[n], \quad |\alpha| < 1 $$

Then its DTFT is:


$$ H(\omega) = \sum_{n=0}^{\infty} \alpha^n e^{-j\omega n} = \frac{1}{1 - \alpha e^{-j\omega}} $$

This is the DTFT of a causal, exponentially decaying signal. It exhibits a low-pass characteristic when $\alpha$ is real and positive.


In [ ]:
%plot -s 560,600

N = 30;

x = zeros(1,N);
for i = 1:N
    x(i) = 0.8^(i-1);
end

n = 0:N-1;
w = linspace(-2,2,2^10)*pi;

X = dtft(x,n,w);

nd = -8:N;
xd = zeros(size(nd));
[y,ny] = sigadd(xd,nd,x,n);

subplot(3,1,1), stem(ny,y,'filled'), xlabel('n')
subplot(3,1,2), plot(w/pi,abs(X)), ylabel('|X(\omega)|')
subplot(3,1,3), plot(w/pi,phase(X)), xlabel('Freq. in \pi units'), ylabel('\angle X(\omega)')




3. DTFT Property

DTFT and Modulation

The modulation property describes how multiplying a signal by a complex exponential in time shifts its frequency content.


$$ e^{j\omega_0 n} x[n] \quad \longleftrightarrow \quad X(\omega - \omega_0) $$

This means that modulation by $e^{j\omega_0 n}$ in the time domain shifts the DTFT by $\omega_0$ in the frequency domain.


Special case: When $\omega_0 = \frac{2\pi}{N}\frac{N}{2}=\pi$, the modulation becomes:


$$ e^{j\pi n} x[n] = (-1)^n x[n] $$

and the frequency shift becomes:


$$ (-1)^n x[n] \quad \longleftrightarrow \quad X(\omega - \pi) $$

This flips the frequency spectrum around $\omega = 0$, effectively swapping low and high frequencies.


In [ ]:
%plot -s 560,600

N = 30;
nd = -8:N;
xd = zeros(size(nd));

x = zeros(1,N);
for i = 1:N
    x(i) = (-0.8)^(i-1);
end
n = 0:N-1;
%w = linspace(-1,1,2^10)*pi;
w = linspace(-2,2,2^10)*pi;

X = dtft(x,n,w);

subplot(3,1,1), stem(nd,sigadd(xd,nd,x,n),'filled'), xlabel('n')
subplot(3,1,2), plot(w/pi,abs(X)), ylabel('|X(\omega)|')
subplot(3,1,3), plot(w/pi,phase(X)), xlabel('Freq. in \pi units'), ylabel('\angle X(\omega)')


DTFT and Time Shift


$$ x[n - m] \quad \longleftrightarrow \quad e^{-j\omega m} X(\omega) $$

This means a shift in time by $m$ samples results in a linear phase shift in the frequency domain, without changing the magnitude of the spectrum.

  • Amplitude remains the same
  • Phase is shifted linearly by $(-\omega m)$

This phase shift corresponds to a rotation in the complex plane that increases linearly with frequency.


In [ ]:
%plot -s 560,600

N = 30;
nd = -8:N;
xd = zeros(size(nd));

x = zeros(1,N);
for i = 1:N
    x(i) = 0.8^(i-1);
end

m = 1;
n = 0+m:N-1+m;
[y,ny] = sigadd(xd,nd,x,n);

w = linspace(-2,2,2^10)*pi;

X = dtft(x,n,w);

subplot(3,1,1), stem(ny,y,'filled'), xlabel('n')
subplot(3,1,2), plot(w/pi,abs(X)),
subplot(3,1,3), plot(w/pi,phase(X)), xlabel('Freq. in \pi units')


DTFT and Convolution

Convolution in the time domain corresponds to multiplication in the frequency domain:


$$ \begin{align*} x[n] &\longleftrightarrow X(\omega) \\ h[n] &\longleftrightarrow H(\omega) \\\\ y[n] = x[n] * h[n] &\longleftrightarrow Y(\omega) = H(\omega)X(\omega) \end{align*} $$

This property is fundamental in signal processing, enabling filtering operations to be performed as simple pointwise multiplication in the frequency domain.




4. Filters

A filter is a system that modifies or processes a signal to achieve a desired effect, often by enhancing certain components and suppressing others. In discrete-time signal processing, filters are implemented using convolution:


$$ y[n] = x[n] * h[n] $$

where:

  • $x[n]$ is the input signal
  • $h[n]$ is the filter's impulse response
  • $y[n]$ is the output (filtered) signal

Frequency-Domain View

Filtering becomes particularly intuitive in the frequency domain:


$$ X(\omega) \longleftrightarrow x[n] \\ H(\omega) \longleftrightarrow h[n] \\ Y(\omega) = H(\omega) X(\omega) $$

This means the output is obtained by multiplying the signal's spectrum $X(\omega)$ with the filter's frequency response $H(\omega)$. This operation allows us to:

  • Pass certain frequencies (where $|H(\omega)|$ is large)
  • Suppress others (where $|H(\omega)|$ is near zero)

Types of Filters

Filters are typically classified by their frequency-selective behavior:

  • Low-pass filter: passes low frequencies, attenuates high ones
  • High-pass filter: passes high frequencies, attenuates low ones
  • Band-pass filter: passes a specific range (band) of frequencies
  • Band-stop filter: removes a specific frequency band
  • All-pass filter: passes all frequencies but modifies phase

Each filter is designed by specifying $h[n]$ (impulse response), which determines $H(\omega)$ via the DTFT.


4.1. Low-pass Filter

A low-pass filter is designed to preserve the low-frequency components of a signal while attenuating the high-frequency components. This frequency-selective behavior is central in applications such as noise reduction and signal smoothing.


Consider a simple example with the following impulse response:


$$ h[n] = \delta[n] + \delta[n - 1] $$

This defines a two-tap filter that performs local averaging across adjacent time samples.


(1) Impulse Response

This time-domain structure implies a smoothing operation in the output signal, as each output sample is an average of two consecutive input samples.


(2) Frequency Response

The Discrete-Time Fourier Transform (DTFT) of $h[n]$ is computed as:


$$ H(\omega) = 1 + e^{-j\omega} = 2\cos\left(\frac{\omega}{2}\right) e^{-j\omega/2} $$

The corresponding magnitude response is:


$$ |H(\omega)| = 2\cos\left(\frac{\omega}{2}\right) $$

This function is maximal at $\omega = 0$ and decreases as $\omega$ approaches $\pm \pi$. Specifically:

  • At $\omega = 0$, $|H(\omega)| = 2$
  • At $\omega = \pm\pi$, $|H(\omega)| = 0$

Hence, the filter strongly attenuates high-frequency components while preserving the low-frequency content. This behavior is characteristic of a low-pass filter.


In [ ]:
%plot -s 560,420

nd = -5:10;
hd = zeros(1,length(nd));

N = 2;
h = ones(1,N);
n = 0:N-1;

w = linspace(-1,1,2^10)*pi;
X = dtft(h,n,w);

[y,ny] = sigadd(hd,nd,h,n);
subplot(2,1,1), stem(ny,y,'filled')
subplot(2,1,2), plot(w/pi,abs(X)), xlabel('freq in \pi units')


4.2. High-Pass Filter

A high-pass filter is designed to suppress low-frequency components of a signal while allowing high-frequency components to pass through. Such filters are useful for tasks like edge detection, signal differentiation, or removing slow-varying trends.


Consider the following impulse response:


$$ h[n] = \delta[n] - \delta[n - 1] $$

This filter performs a differencing operation—measuring the change between adjacent signal samples.


(1) Impulse Response

This structure results in a difference operation between adjacent values, enhancing sharp transitions and removing slow or constant trends.


(2) Frequency Response

The DTFT of the impulse response is:


$$ H(\omega) = 1 - e^{-j\omega} = 2j \sin\left(\frac{\omega}{2}\right) e^{-j\omega/2} $$

and the magnitude response is:


$$ |H(\omega)| = 2 \left| \sin\left(\frac{\omega}{2} \right) \right| $$

This function is minimal at $\omega = 0$ (where $|H(0)| = 0$) and maximal at $\omega = \pm \pi$ (where $|H(\pi)| = 2$). Therefore, the filter strongly attenuates low-frequency components while emphasizing high-frequency variations.


This behavior is characteristic of a high-pass filter.


In [ ]:
%plot -s 560,420

nd = -5:10;
hd = zeros(1,length(nd));

N = 2;
h = [1 -1];
n = 0:N-1;

w = linspace(-1,1,2^10)*pi;
X = dtft(h,n,w);

[y,ny] = sigadd(hd,nd,h,n);
subplot(2,1,1), stem(ny,y,'filled')
subplot(2,1,2), plot(w/pi,abs(X)), xlabel('freq in \pi units')


4.3. Band-Pass Filter

A band-pass filter allows frequencies within a specified range to pass through while attenuating both low and high frequencies outside this band. Such filters are commonly used in communications and audio processing to isolate specific frequency components.


Consider the following impulse response:


$$ h[n] = \delta[n] + \delta[n - 1] - \delta[n - 2] - \delta[n - 3] $$

This filter is a superposition of a low-pass component and a delayed, inverted low-pass component. It resembles a differenced average filter, which selectively enhances mid-range frequency content.


(1) Impulse Response

The symmetric structure with alternating signs hints at a band-selective behavior.


(2) Frequency Response

The DTFT of this impulse response is:


$$ \begin{align*} H(\omega) &= (1 + e^{-j\omega}) - (e^{-j2\omega} + e^{-j3\omega}) \\ &= e^{-j\omega} \left( e^{j\omega} + 1 - e^{-j\omega} - e^{-2j\omega} \right) \end{align*} $$

Though the exact closed form may be algebraically involved, the magnitude response shows a clear band-pass shape:

  • Peaks at mid-range frequencies (around $\omega = \pm \frac{\pi}{2}$)
  • Null at $\omega = 0$ (DC component)
  • Attenuation as $\omega \to \pm \pi$

This demonstrates that the filter suppresses both the lowest and highest frequency components while passing those in the middle of the spectrum.


In [ ]:
%plot -s 560,420
nd = -5:10;
hd = zeros(1,length(nd));

N = 4;
h = [1 1 -1 -1];
n = 0:N-1;

w = linspace(-1,1,2^10)*pi;
X = dtft(h,n,w);

[y,ny] = sigadd(hd,nd,h,n);
subplot(2,1,1), stem(ny,y,'filled')
subplot(2,1,2), plot(w/pi,abs(X)), xlabel('freq in \pi units')


The Second Example of Band-Pass Filter

(1) Impulse Response

Let the impulse response be:


$$ h[n] = \delta[n] - \delta[n - 2] $$

This is a differencing filter with a gap of 2 samples, creating destructive interference at low and high frequencies while reinforcing energy around the middle frequencies.


(2) Frequency Response

The DTFT of this filter is:


$$ H(\omega) = 1 - e^{-j2\omega} = 2j \sin(\omega) e^{-j\omega} $$

and its magnitude response is:


$$ |H(\omega)| = 2 \left| \sin(\omega) \right| $$

This response:

  • Vanishes at $\omega = 0$ and $\omega = \pi$
  • Reaches its maximum at $\omega = \pm \frac{\pi}{2}$

This is the hallmark of a band-pass filter, with mid-frequency amplification and suppression of low and high frequencies.


In [ ]:
%plot -s 560,420

nd = -5:10;
hd = zeros(1,length(nd));

N = 3;
h = [1 0 -1];
n = 0:N-1;

w = linspace(-1,1,2^10)*pi;
X = dtft(h,n,w);

[y,ny] = sigadd(hd,nd,h,n);
subplot(2,1,1), stem(ny,y,'filled')
subplot(2,1,2), plot(w/pi,abs(X)), xlabel('freq in \pi units')


4.4. Impulse Response of the Ideal Low-Pass Filter

The ideal low-pass filter perfectly passes all frequency components in the interval $[-\omega_c, \omega_c]$ and completely suppresses all others. It is defined by the frequency response:


$$ H(\omega) = \begin{cases} 1 & -\omega_c \leq \omega \leq \omega_c \\ 0 & \text{otherwise} \end{cases} $$

This filter retains only the low-frequency content near $\omega = 0$ and removes high-frequency oscillations.


To obtain the corresponding impulse response $h[n]$, we compute the inverse DTFT:


$$ h[n] = \frac{1}{2\pi} \int_{-\pi}^{\pi} H(\omega) e^{j\omega n} \, d\omega = \frac{1}{2\pi} \int_{-\omega_c}^{\omega_c} e^{j\omega n} \, d\omega $$

This evaluates to:


$$ h[n] = \frac{1}{2\pi} \cdot \frac{e^{j\omega_c n} - e^{-j\omega_c n}}{j n} = \frac{\sin(\omega_c n)}{\pi n} $$

Therefore, the complete impulse response is:


$$ h[n] = \frac{\sin(\omega_c n)}{\pi n} = \frac{\omega_c}{\pi} \text{sinc} \left(\frac{\omega_c}{\pi}n \right) $$

This is a scaled sinc function, and represents the ideal low-pass filter in discrete time.


MATLAB Note

MATLAB defines the normalized sinc function as:


$$ \text{sinc}(x) = \frac{\sin(\pi x)}{\pi x} $$
In [ ]:
%plot -s 560,600

wc = pi/6;

N = 30;
n = -N:N;

h = zeros(1,length(n));
for i = 1:length(n)
    h(i) = 2*wc*sinc(1/pi*wc*(i-N-1));
end

w = linspace(-1,1,2^10)*pi;

X = dtft(h,n,w);

subplot(2,1,1), stem(n,h,'filled','markersize',4), ylabel('x[n]')
subplot(2,1,2), plot(w/pi,abs(X)), ylabel('X(\omega)')
xlabel('Freq. in \pi units'), ylabel('X(\omega)')

In [ ]:
%plot -s 560,600

wc = pi/6;

N = 100;
n = -N:N;

h = zeros(1,length(n));
for i = 1:length(n)
    h(i) = 2*wc*sinc(1/pi*wc*(i-N-1));
end

w = linspace(-1,1,2^10)*pi;

X = dtft(h,n,w);

subplot(2,1,1), stem(n,h,'filled','markersize',4), ylabel('x[n]')
subplot(2,1,2), plot(w/pi,abs(X)), ylabel('X(\omega)')
xlabel('Freq. in \pi units'), ylabel('X(\omega)')


Impulse Response of the Ideal High-Pass Filter

An ideal high-pass filter is designed to pass high-frequency components while attenuating low frequencies. Its frequency response is the complement of an ideal low-pass filter:


$$ H_H(\omega) = \begin{cases} 0, & -\omega_c \le \omega \le \omega_c, \\ 1, & \text{otherwise}. \end{cases} $$

Rather than computing its inverse transform directly, we can relate the impulse response of the ideal high-pass filter, $h_H[n]$, to that of the ideal low-pass filter, $h_L[n]$.


The ideal high-pass filter can be obtained by modulating the ideal low-pass filter by $\pi$ radians:


$$ h_H[n] = (-1)^n h_L[n] = e^{j\pi n} h_L[n] $$

This modulation effectively shifts the frequency response of the low-pass filter from being centered at $\omega = 0$ to being centered at $\omega = \pi$, thereby creating a high-pass response.


In [ ]:
%plot -s 560,600

wc = pi/6;

N = 30;
n = -N:N;

d = zeros(1,length(n));
h = zeros(1,length(n));
d(N+1) = d(N+1) + 1;

for i = 1:length(n)
    h(i) =  (-1)^(i-N-1)*2*wc*sinc(1/pi*wc*(i-N-1));
end

w = linspace(-1,1,2^10)*pi;

X = dtft(h,n,w);

subplot(2,1,1), stem(n,h,'filled','markersize',4), ylabel('x[n]')
subplot(2,1,2), plot(w/pi,abs(X)), ylabel('X(\omega)')
xlabel('Freq. in \pi units'), ylabel('X(\omega)')

5. High-Density Spectrum and High-Resolution Spectrum

Consider the signal:


$$ x[n] = \cos(0.48\pi n) + \cos(0.52\pi n) $$

This signal contains two sinusoids with closely spaced frequencies near $\omega = \pi$.


In [ ]:
N = 100;
n = 0:N-1;
x = cos(0.48*pi*n) + cos(0.52*pi*n);


Use 100 Samples of $x[n]$

We begin by generating 100 samples of $x[n]$. The frequency difference between the two components is small ($0.04\pi$), so we need sufficient time-domain data to resolve both components in the frequency domain.


In [ ]:
%plot -s 560,420

k = n;
X = dft(x,N);
w = 2*pi/100*k;

subplot(2,1,1), stem(n,x,'filled')
subplot(2,1,2), stem(w/pi,abs(X),'filled')

Compute only the First 10-Point DFT

Suppose we compute a 10-point DFT using the first 10 samples from the 100-point sequence. This results in a very coarse frequency resolution. The frequency bins are widely spaced:


$$ \Delta \omega = \frac{2\pi}{10} = 0.2\pi $$

This is too coarse to distinguish between the two closely spaced sinusoids, which will appear merged or indistinct.


In [ ]:
%plot -s 560,420

n1 = 0:9;
y1 = x(1:10);
Y1 = dft(y1,10);
k1 = n1;
w1 = 2*pi/10*k1;

subplot(2,1,1), stem(n1,y1,'filled')
subplot(2,1,2), stem(w1/pi,abs(Y1),'filled')


Zero-Padding to Increase Density

To obtain a denser spectrum, we pad the 10-point sequence with 90 zeros, forming a 100-point sequence. The resulting 100-point DFT provides a smoother, interpolated view of the spectral content.


In [ ]:
%plot -s 560,420

n2 = 0:N-1;
y2 = [x(1:10), zeros(1,90)];
Y2 = dft(y2,N);
k2 = n2;
w2 = 2*pi/100*k2;

subplot(2,1,1), stem(n2,y2,'filled')
subplot(2,1,2), stem(w2/pi,abs(Y2),'filled')


Key Insight

  • High-density spectrum: Zero-padding provides a finer frequency grid, yielding a smoother curve.
  • High-resolution spectrum: To truly distinguish close frequency components, we need more nonzero time-domain samples, not just zero-padding.

Conclusion:

Padding with zeros to create a high-density spectrum improves the visual smoothness but does not enhance frequency resolution. It does not reveal new frequency content or allow better separation of closely spaced components.


In [ ]:
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')