The frequency domain

Lecture 3 · Digital Signal Processing · University of Klagenfurt, 2022

Nunzio Alexandro Letizia

This lecture

Lecture 3 of 6

  1. The Fourier series
  2. The Fourier transform and the sampling theorem
  3. Discrete signals: the DTFT, the DFT and the FFT

From Digital Signal Processing at the University of Klagenfurt, first taught in 2020: this is the edition of summer 2022, so some of it may be a little dated. All lectures.

The Fourier series

01

Fourier series

Any periodic signal can be decomposed into sine and cosine components:

x(t)=\frac{A_0}{2}+\sum_{k=1}^{+\infty}A_k\cos(2\pi kf_0t)+B_k\sin(2\pi kf_0t)

where f_0=\frac{1}{T_0} is the fundamental frequency of x(t), and the Fourier coefficients are

A_k=\frac{2}{T_0}\int_{-T_0/2}^{T_0/2}x(t)\cos(2\pi kf_0t)\,dt,\qquad B_k=\frac{2}{T_0}\int_{-T_0/2}^{T_0/2}x(t)\sin(2\pi kf_0t)\,dt

A sum of harmonics

The Fourier series decomposes a signal x(t) into harmonics, at the multiples kf_0 of the fundamental frequency.

A square wave and its Fourier series truncated at the first, the third and the twenty-fifth harmonic, closer and closer to the square.

The spectrum of a sawtooth

The coefficients say how much of each harmonic the signal contains. A sawtooth has a jump every period, and its coefficients decay slowly, as 1/k:

Left: a sawtooth of period T0. Right: the magnitude of its Fourier coefficients, decaying as one over k.

Properties

  • If x(t) is even in \left[-\frac{T_0}{2},\frac{T_0}{2}\right], then B_k\equiv0 for all k>0.
  • If x(t) is odd in \left[-\frac{T_0}{2},\frac{T_0}{2}\right], then A_k\equiv0 for all k\ge0.

Parseval’s theorem relates the energy of the signal in a period to the energy of its Fourier coefficients:

\frac{2}{T_0}\int_{-T_0/2}^{T_0/2}|x(t)|^2\,dt=\frac{A_0^2}{2}+\sum_{k=1}^{+\infty}\left(A_k^2+B_k^2\right)

Where the coefficients come from

Multiply the series by \cos(2\pi mf_0t), with m\ge1, and integrate over one period. The constant and all the sines integrate to zero, and the cosines are orthogonal:

\int_{-T_0/2}^{T_0/2}\cos(2\pi kf_0t)\cos(2\pi mf_0t)\,dt=\frac{T_0}{2}\,\delta_{k,m},\qquad \delta_{k,m}=\begin{cases}1&k=m\\0&k\neq m\end{cases}

so only the term k=m survives:

\int_{-T_0/2}^{T_0/2}x(t)\cos(2\pi mf_0t)\,dt=A_m\,\frac{T_0}{2}\quad\Longrightarrow\quad A_m=\frac{2}{T_0}\int_{-T_0/2}^{T_0/2}x(t)\cos(2\pi mf_0t)\,dt

The same with \sin(2\pi mf_0t) gives B_m; integrating x(t) directly gives A_0, which is why the constant term is written \frac{A_0}{2}.

Ex. 1

Calculate the Fourier series of

  1. x(t)=\mathrm{rect}(t) on [-1,1];
  2. x(t)=t on [-1,1], and evaluate it at t=\frac12. What is the value of 1-\frac13+\frac15-\frac17+\frac19-\dots?
  3. x(t)=|\cos(t)| on [0,\pi];
  4. x(t)=\mathrm{triangle}(t) on [-1,1] (from an exam of 2020; optional);
  5. x(t)=e^{at} on [-L,L] (optional).

Ex. 1: solutions

1. T_0=2, f_0=\frac12; even, so B_k=0:

A_0=\int_{-1/2}^{1/2}1\,dt=1,\qquad A_k=\int_{-1/2}^{1/2}\cos(\pi kt)\,dt=\frac{2\sin(\pi k/2)}{\pi k}=\mathrm{sinc}\left(\frac k2\right),\qquad x(t)=\frac12+\sum_{k=1}^{\infty}\mathrm{sinc}\left(\frac k2\right)\cos(\pi kt)

2. Odd, so A_k=0; by parts,

B_k=2\int_0^1t\sin(\pi kt)\,dt=-\frac{2\cos(\pi k)}{\pi k}+0=\frac{2(-1)^{k+1}}{\pi k},\qquad x(t)=\sum_{k=1}^{\infty}\frac{2(-1)^{k+1}}{\pi k}\sin(\pi kt)

At t=\frac12, \sin\frac{\pi k}{2}=1,0,-1,0,\dots, so

\frac12=\frac2\pi\left(1-\frac13+\frac15-\frac17+\dots\right)\quad\Longrightarrow\quad1-\frac13+\frac15-\frac17+\dots=\frac\pi4

Ex. 1: solutions, continued

3. Take the period \left[-\frac\pi2,\frac\pi2\right]: T_0=\pi, 2\pi kf_0t=2kt, even. With 2\cos t\cos2kt=\cos((2k+1)t)+\cos((2k-1)t):

A_0=\frac4\pi,\qquad A_k=\frac2\pi(-1)^k\left(\frac{1}{2k+1}-\frac{1}{2k-1}\right)=\frac{4(-1)^{k+1}}{\pi(4k^2-1)},\qquad |\cos t|=\frac2\pi+\frac4\pi\sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{4k^2-1}\cos(2kt)

4. T_0=2, even; by parts the boundary terms vanish:

A_0=1,\qquad A_k=2\int_0^1(1-t)\cos(\pi kt)\,dt=\frac{2\left(1-(-1)^k\right)}{\pi^2k^2}=\mathrm{sinc}^2\left(\frac k2\right)

5. T_0=2L; with \sin(\pi k)=0,

A_0=\frac{2\sinh(aL)}{aL},\qquad A_k=\frac{2aL(-1)^k\sinh(aL)}{a^2L^2+\pi^2k^2},\qquad B_k=\frac{2\pi k(-1)^{k+1}\sinh(aL)}{a^2L^2+\pi^2k^2}

Items 4 and 5 had no written solution in my notes for this course: item 4 follows my solution for Communications Engineering, item 5 is added for the web version.

Assignment 1

a. Compute the convolution z(t)=x*y(t), a>0, where x(t)=\mathrm{rect}(t) and

y(t)=\begin{cases}\sin(t)&0\le t<a\\0&\text{otherwise}\end{cases}

  • Evaluate the area of z(t).
  • Find the maximum value of z(t). Does it depend on a?
  • Bonus: a Matlab function that takes a and sketches z(t).

b. Compute the Fourier series of the periodic signal in the figure.

  • Express the periodic signal in analytic form.
  • Compute the Fourier transform of the signal in t\in[-1,1).

A periodic signal of period 2: a sine arch from minus a half to a half, zero elsewhere in the period, with jumps at plus and minus a half.

the signal of exercise b

Assignment 1: the solution, exercise a

x lasts 1 and y lasts a, so z(t)=\int_{t-1/2}^{t+1/2}y(\tau)\,d\tau lasts a+1. For a\le1 and for a>1:

z(t)=\begin{cases}1-\cos\left(t+\frac12\right)&-\frac12\le t<a-\frac12\\1-\cos a&a-\frac12\le t<\frac12\\\cos\left(t-\frac12\right)-\cos a&\frac12\le t<a+\frac12\end{cases}\qquad z(t)=\begin{cases}1-\cos\left(t+\frac12\right)&-\frac12\le t<\frac12\\2\sin\frac12\,\sin t&\frac12\le t<a-\frac12\\\cos\left(t-\frac12\right)-\cos a&a-\frac12\le t<a+\frac12\end{cases}

and 0 elsewhere. The area is A(z)=A(x)\,A(y)=1-\cos a. The window of length 1 collects at most 2\sin\frac12 of the sine, when it is centred on its peak at \frac\pi2:

\max z=\begin{cases}1-\cos a&0<a\le1\\2\sin\frac12\,\sin\left(a-\frac12\right)&1<a\le\frac\pi2+\frac12\\2\sin\frac12\approx0.959&a>\frac\pi2+\frac12\end{cases}

It depends on a until it saturates.

My solution sheet left the maximum for a>1 blank: the last two cases are added for the web version.

Assignment 1: the solution, exercise b

One period is x(t)=\sin(\pi t)\,\mathrm{rect}(t), and x_p(t)=\sum_kx(t-2k): T_0=2, f_0=\frac12. The signal is odd, so only the sines remain:

B_k=2\int_0^{1/2}\sin(\pi t)\sin(\pi kt)\,dt=\frac12\,\mathrm{sinc}\left(\frac{k-1}{2}\right)-\frac12\,\mathrm{sinc}\left(\frac{k+1}{2}\right)

that is B_1=\frac12, B_k=0 for odd k\ge3, and B_k=\dfrac{-2k\cos\frac{k\pi}{2}}{\pi(k^2-1)} for even k:

x_p(t)=\frac12\sin(\pi t)+\frac4\pi\sum_{m=1}^{\infty}\frac{(-1)^{m+1}m}{4m^2-1}\sin(2\pi mt)

The transform of one period: a product in time, a convolution in frequency,

X(f)=\mathrm{sinc}(f)*\frac{1}{2j}\left[\delta\left(f-\tfrac12\right)-\delta\left(f+\tfrac12\right)\right]=\frac{1}{2j}\left[\mathrm{sinc}\left(f-\tfrac12\right)-\mathrm{sinc}\left(f+\tfrac12\right)\right]=\frac{4f\cos(\pi f)}{j\pi\left(1-4f^2\right)}

and indeed B_k=j\,X\left(\frac k2\right): the coefficients are samples of the transform.

From series to transform

What if the signal is not periodic? An aperiodic signal can be seen as a periodic signal with period T_0\to\infty. Take x(t)=\mathrm{rect}(t), repeated with period T_0=2, 10 and 100:

Rect pulses repeated every 2, 10 and 100 seconds, and their Fourier coefficients times T0: the lines get denser and fill in the sinc curve.

The lines T_0c_k sit at f=k/T_0, closer and closer: in the limit they become a continuous function of f, the Fourier transform.

The Fourier transform

02

The Fourier transform

The Fourier transform decomposes a signal into its constituent frequencies:

X(f)=\int_{-\infty}^{+\infty}x(t)\,e^{-j2\pi ft}\,dt

Under some conditions it is invertible:

x(t)=\int_{-\infty}^{+\infty}X(f)\,e^{j2\pi ft}\,df

On a computer: the FFT and its inverse, the IFFT.

The rect in time and its Fourier transform, the sinc in frequency.

Time and frequency domains

x(t) is defined on a group I, here the time domain, and X(f) on the dual group \hat I, the frequency domain.

Signal Time, I Frequency, \hat I
continuous, aperiodic \mathbb{R} \mathbb{R}
continuous, periodic \mathbb{R}/\mathbb{Z}(T_0) \mathbb{Z}(1/T_0)
discrete, aperiodic \mathbb{Z}(T) \mathbb{R}/\mathbb{Z}(1/T)
discrete, periodic \mathbb{Z}(T)/\mathbb{Z}(T_0) \mathbb{Z}(1/T_0)/\mathbb{Z}(1/T)

Periodic in one domain means discrete in the other: the Fourier series of the first part is the transform on \mathbb{R}/\mathbb{Z}(T_0).

Properties

With I=\mathbb{R} and \mathcal{F}[x(t)]:=X(f)=\displaystyle\int_{-\infty}^{+\infty}x(t)\,e^{-j2\pi ft}\,dt:

linearity \mathcal{F}[\alpha_1x_1(t)+\alpha_2x_2(t)]=\alpha_1X_1(f)+\alpha_2X_2(f)
flipping \mathcal{F}[x(-t)]=X(-f)
conjugation \mathcal{F}[x^*(t)]=X^*(-f)
time shift \mathcal{F}[x(t-t_0)]=X(f)\,e^{-j2\pi ft_0}
frequency shift \mathcal{F}\left[x(t)\,e^{j2\pi f_0t}\right]=X(f-f_0)
scaling \mathcal{F}[x(at)]=\frac{1}{|a|}X\left(\frac{f}{a}\right)
derivative \mathcal{F}\left[\frac{dx(t)}{dt}\right]=j2\pi f\,X(f)
integral \mathcal{F}\left[\int_{-\infty}^{t}x(\tau)\,d\tau\right]=\frac12X(0)\,\delta(f)+\frac{X(f)}{j2\pi f}

Convolution and Parseval

Product/convolution rule. Let z(t)=x*y(t). Then

Z(f)=X(f)\cdot Y(f)

where X(f) and Y(f) are the Fourier transforms of x(t) and y(t).

Parseval’s theorem. For x(t), y(t), t\in I:

\int_{I}x(t)\,y^*(t)\,dt=\int_{\hat I}X(f)\,Y^*(f)\,df

where \hat I is the dual domain of I. With y=x, the energy is the same in both domains.

Ex. 2

Compute the Fourier transform X(f) of

  1. x(t)=\mathrm{rect}\left(\frac{t-t_0}{D}\right)
  2. x(t)=\cos(2\pi f_0t)
  3. x(t)=\mathrm{triangle}(t)
  1. x(t)=e^{-a|t|}
  2. x(t)=e^{-\pi t^2}
  3. x(t)=\sin(2\pi f_0t)\cdot e^{-\pi t^2}

Evaluate the area of x(t)=\mathrm{sinc}^4(t).

Ex. 2: solutions

1. \displaystyle\mathcal{F}[\mathrm{rect}(t)]=\int_{-1/2}^{1/2}e^{-j2\pi ft}\,dt=\frac{e^{j\pi f}-e^{-j\pi f}}{j2\pi f}=\mathrm{sinc}(f); scaling by D and shifting by t_0: \ X(f)=D\,\mathrm{sinc}(Df)\,e^{-j2\pi ft_0}.

2. \mathcal{F}[\delta(t)]=1 and, by duality, \mathcal{F}[1]=\delta(f). Writing the cosine with exponentials:

X(f)=\frac12\delta(f-f_0)+\frac12\delta(f+f_0),\qquad \mathcal{F}[\sin(2\pi f_0t)]=\frac{1}{2j}\left[\delta(f-f_0)-\delta(f+f_0)\right]

3. \mathrm{triangle}=\mathrm{rect}*\mathrm{rect}, so X(f)=\mathrm{sinc}^2(f).

4. \displaystyle X(f)=\int_{-\infty}^0e^{t(a-j2\pi f)}dt+\int_0^{\infty}e^{-t(a+j2\pi f)}dt=\frac{1}{a-j2\pi f}+\frac{1}{a+j2\pi f}=\frac{2a}{a^2+4\pi^2f^2}

Ex. 2: solutions, continued

5. Complete the square, -\pi(t^2+j2ft)=-\pi(t+jf)^2-\pi f^2, and shift the integration path by jf (Cauchy’s theorem allows it):

X(f)=e^{-\pi f^2}\int_{-\infty}^{+\infty}e^{-\pi(t+jf)^2}\,dt=e^{-\pi f^2}

6. A product in time is a convolution in frequency:

X(f)=\frac{1}{2j}\left[\delta(f-f_0)-\delta(f+f_0)\right]*e^{-\pi f^2}=\frac{1}{2j}\left[e^{-\pi(f-f_0)^2}-e^{-\pi(f+f_0)^2}\right]

purely imaginary and odd: two Gaussian bumps, at \pm f_0, with opposite signs.

Area. \mathrm{sinc}^4=\mathrm{sinc}^2\cdot\mathrm{sinc}^2 and \mathcal{F}\left[\mathrm{sinc}^2\right]=\mathrm{triangle}; by Parseval,

\int_{-\infty}^{+\infty}\mathrm{sinc}^4(t)\,dt=\int_{-1}^{1}\mathrm{triangle}^2(f)\,df=2\int_0^1(1-f)^2\,df=\frac23

Sampling, DTFT, DFT, FFT

03

Band and bandwidth

  • Spectral extension: \varepsilon(X)=(f_0,f_1) such that X(f)=0 for f\notin\varepsilon(X)
  • Bandwidth: the measure of \varepsilon(X)

If x(t) is real, X(f)=X^*(-f) is Hermitian and its magnitude is symmetric around the origin, |X(f)|=|X(-f)|. Then the band B is defined through the interval (-B,B): X(f)=0 for |f|>B.

A spectrum magnitude that is zero outside the interval from minus B to B.

The sampling theorem

Let x(t) be a real band-limited signal, X(f)=0 for |f|>B. Then it can be exactly reconstructed from its samples x(nT) if the sampling frequency is

F_c=\frac{1}{T}>2B

The reconstruction formula is

x(t)=\sum_{n=-\infty}^{\infty}x(nT)\,\mathrm{sinc}\left(\frac{t-nT}{T}\right)

  • If F_c<2B, aliasing occurs.
  • A signal of finite duration has an unlimited band; and in practice \mathrm{sinc}(t) has infinite duration.

Aliasing

Sampling every T repeats the spectrum every F_c=1/T. The reconstruction filter keeps |f|<F_c/2: it gets the original spectrum back only if the copies do not overlap.

Sampling copies the spectrum every Fc. Top: Fc larger than 2B, the copies stay apart. Bottom: Fc smaller than 2B, the copies overlap and add up.

An example

What is the minimum sampling frequency F_s to reconstruct x(t)=\sin(2\pi t)\cdot\mathrm{sinc}^2(t) from its samples?

Left: the signal, an oscillation inside a decaying envelope. Right: its spectrum, purely imaginary, two triangles centred at plus and minus one hertz, zero beyond two hertz.

\mathcal{F}\left[\mathrm{sinc}^2(t)\right]=\mathrm{triangle}(f), band 1 Hz; multiplying by \sin(2\pi t) moves it to \pm1 Hz: \ X(f)=\frac{1}{2j}\left[\mathrm{triangle}(f-1)-\mathrm{triangle}(f+1)\right], so B=2 Hz and F_s>4 Hz.

The example in Matlab

%% Sampling theorem example signal with Fc = 100
Fc = 100;
t0 = [-2:1/Fc:2]+0.0001;
x0 = sin(2*pi*t0).*sin(pi*t0).^2./(pi*pi*t0.^2);

[x_r1,x_d] = SamplingTheorem(t0,x0,20);
[x_r2,~] = SamplingTheorem(t0,x0,33);
[x_r3,~] = SamplingTheorem(t0,x0,40);
function [x_r,x_d] = SamplingTheorem(t,x,N)
% keep one sample out of N, reconstruct with sinc
% ...
s = sin(pi*t./T2)./(pi*t./T2);
x_r = conv(x_d,s,'same');

Matlab plot of the three reconstructions: at 5 Hz the curve follows the original signal, at 3 and 2.5 Hz it departs from it.

the reconstructions, saved from the run

The signal is simulated at 100 Hz, then one sample out of N is kept: N=20, 33, 40 give 5, about 3 and 2.5 Hz. Only 5 Hz is above 2B=4 Hz, and only that reconstruction follows the signal.

The DTFT

What if the signal is discrete? First an aperiodic discrete-time signal: its Fourier transform is the discrete-time Fourier transform (DTFT). It goes from I=\mathbb{Z}(T) to \hat I=\mathbb{R}/\mathbb{Z}(1/T): the transform is continuous and periodic, with period 1/T.

X(f)=T\sum_{k=-\infty}^{+\infty}x(kT)\,e^{-j2\pi fkT}

It satisfies the first five properties of the Fourier transform: linearity, flipping, conjugation, time and frequency shift.

Left: samples of a sinc-like signal. Right: its DTFT, a rect repeated every 1 over T.

Ex. 3

Compute the discrete-time Fourier transform X(f) of

  1. x(kT)=a^k\cdot1_0(kT), with |a|<1;
  2. x(kT)=2^{-k}\cdot1_0(kT), and sketch its magnitude;
  3. x(kT)=p_N(kT), with N odd and p_N(kT)=\begin{cases}1&-\frac{N-1}{2}\le k\le\frac{N-1}{2}\\0&\text{elsewhere}\end{cases}

Ex. 3: solutions

1. A geometric series in q=a\,e^{-j2\pi fT}, with |q|=|a|<1:

X(f)=T\sum_{k=0}^{\infty}\left(a\,e^{-j2\pi fT}\right)^k=\frac{T}{1-a\,e^{-j2\pi fT}}

2. With a=\frac12:

|X(f)|=\frac{T}{\left|1-\frac12e^{-j2\pi fT}\right|}=\frac{T}{\sqrt{\frac54-\cos(2\pi fT)}}

periodic with period \frac1T, from 2T at f=0 down to \frac23T at f=\pm\frac{1}{2T}.

3. Shift the index by \frac{N-1}{2} and sum the geometric series:

X(f)=T\,e^{j\pi f(N-1)T}\,\frac{1-e^{-j2\pi fNT}}{1-e^{-j2\pi fT}}=T\,\frac{\sin(\pi fNT)}{\sin(\pi fT)}

real, since p_N is symmetric, and equal to NT at f=0: the discrete counterpart of the sinc.

The DFT

What if the signal is discrete and periodic? Its Fourier transform is the discrete Fourier transform (DFT). It goes from I=\mathbb{Z}(T)/\mathbb{Z}(T_0) to \hat I=\mathbb{Z}(1/T_0)/\mathbb{Z}(1/T): the transform is discrete and periodic, with period 1/T.

Here T_0=NT. Call F=1/T_0 the quantum frequency; then F\cdot T=\frac{1}{T_0}\cdot\frac{T_0}{N}=\frac1N, and the DFT of the periodic signal x(kT) is

X(hF)=T\sum_{k=0}^{N-1}x(kT)\,e^{-j2\pi hFkT}=T\sum_{k=0}^{N-1}x(kT)\,e^{-j2\pi\frac{hk}{N}}=T\sum_{k=0}^{N-1}x(kT)\,W_N^{hk}

where W_N=e^{-j\frac{2\pi}{N}} is a root of unity and 0\le h<N.

It can be read as the sampled version of the DTFT, or as the DTFT of the periodic version of x(kT). The FFT is a fast algorithm to compute it.

Ex. 4

Compute the discrete Fourier transform X(hF) of the periodic signals

  1. x(k)=[20,\,10]
  2. x(k)=[1,\,2,\,3,\,4]
  3. x(k)=[1,0,0,\dots,0,0,1], of N samples
  4. x(kT)=\cos\left(\frac{2\pi kT}{N}\right)

Ex. 4: from the exam of 2020

An N-point signal is x(n)=[1,-1,1,-1,\dots,(-1)^{N-1}], 0\le n\le N-1.

  1. Find the 2-point DFT of x(n)=[1,-1], in polar coordinates.
  2. Find the N-point DFT X(h), in algebraic coordinates.
  3. Let x_f(n) be the flipped version of x(n). Find its DFT X_f(h).

Ex. 4: solutions

With T=1, X(hF)=\sum_{k=0}^{N-1}x(k)\,e^{-j2\pi hk/N}.

1. N=2: \ X=20+10\,e^{-j\pi h}=[30,\ 10].

2. N=4: \ X=1+2e^{-j\frac{\pi h}{2}}+3e^{-j\pi h}+4e^{-j\frac{3\pi h}{2}}=[10,\ -2+2j,\ -2,\ -2-2j].

3. X(hF)=1+e^{-j2\pi h\frac{N-1}{N}}=1+e^{j\frac{2\pi h}{N}}=2\,e^{j\frac{\pi h}{N}}\cos\left(\frac{\pi h}{N}\right).

4. With \cos\frac{2\pi k}{N}=\frac12\left(e^{j\frac{2\pi k}{N}}+e^{-j\frac{2\pi k}{N}}\right), each half is a sum of N roots of unity:

X(hF)=\frac12\sum_{k=0}^{N-1}e^{-j\frac{2\pi k(h-1)}{N}}+\frac12\sum_{k=0}^{N-1}e^{-j\frac{2\pi k(h+1)}{N}}

The first sum is N at h=1 and 0 otherwise; the second is N at h=N-1 and 0 otherwise. So X=\left[0,\ \frac N2,\ 0,\dots,0,\ \frac N2\right]: one line at \pm\frac1N, as for the cosine in continuous time.

Ex. 4: the exam exercise

1. X(h)=1-e^{-j\pi h}=2j\,e^{-j\frac{\pi h}{2}}\sin\left(\frac{\pi h}{2}\right)=2\sin\left(\frac{\pi h}{2}\right)e^{-j\left(\frac{\pi h}{2}-\frac\pi2\right)}, that is X=[0,\ 2].

2. A geometric series in q=-e^{-j\frac{2\pi h}{N}}:

X(h)=\sum_{k=0}^{N-1}\left(-e^{-j\frac{2\pi h}{N}}\right)^k=\frac{1-(-1)^N}{1+e^{-j\frac{2\pi h}{N}}}

  • N odd: \ X(h)=\dfrac{2}{1+e^{-j\frac{2\pi h}{N}}}=\dfrac{e^{j\frac{\pi h}{N}}}{\cos\frac{\pi h}{N}}=1+j\tan\left(\dfrac{\pi h}{N}\right)
  • N even: \ X(h)=0 for h\neq\frac N2, and X\left(\frac N2\right)=\sum_k(-1)^k(-1)^k=N: all the energy at the highest frequency.

3. Flipping in time flips in frequency: X_f(h)=X(-h)=X(N-h). For N even nothing changes; for N odd, X_f(h)=1-j\tan\left(\frac{\pi h}{N}\right).

Item 3 had no written solution in my notes: this one is added for the web version.

The cost of the DFT

How many operations does the DFT need? Take T=1:

X\left(\frac hN\right)=\sum_{k=0}^{N-1}x(k)\,W_N^{hk}

Each product x(k)\cdot W_N^{hk} takes 6 real operations, 4 products and 2 sums (real and imaginary part). It is repeated N times and summed (2N real sums): 8N operations for each of the N components, 8N^2 in total.

\text{DFT}\sim O(N^2)

Can we get the same result with less work? The fast Fourier transform.

The FFT

The idea: compute the even and the odd components separately. For N=2^m,

X(h)=\sum_{k=0}^{N-1}x(k)\,W_N^{hk},\qquad h=0,1,\dots,N-1

and for l=0,1,\dots,\frac N2-1,

X(2l)=\sum_{a=0}^{\frac N2-1}x_+(a)\,W_{N/2}^{al},\qquad X(2l+1)=\sum_{a=0}^{\frac N2-1}x_-(a)\,W_{N/2}^{al}

with x_+(a)=x(a)+x\left(a+\frac N2\right) and x_-(a)=\left[x(a)-x\left(a+\frac N2\right)\right]W_N^a: two DFTs on \frac N2 samples each.

That costs 8\left(\frac N2\right)^2+8\left(\frac N2\right)^2=4N^2 operations instead of 8N^2. Repeating the split \log_2N times gives

\text{FFT}\sim O(N\log_2N)

The FFT with N=8

The FFT flow graph for 8 samples: three stages of butterflies; inputs in natural order, outputs in bit-reversed order X0, X4, X2, X6, X1, X5, X3, X7.

each butterfly: the sum goes up, the difference times W_8^a goes down; the outputs come out in bit-reversed order