# SPTK: The Fourier Series

This installment of the Signal Processing Toolkit shows how the Fourier series arises from a consideration of representing arbitrary signals as vectors in a signal space. We also provide several examples of Fourier series calculations, interpret the Fourier series, and discuss its relevance to cyclostationary signal processing.

### Derivation of the Complex Fourier Series

Let’s use the orthogonal basis-function representation machinery we sketched in the signal representations post to derive the Fourier series.  The machinery involves some set of basis, or building-block, functions $\phi_k(t)$ that possess an orthogonality property: When multiplied together and integrated, you get zero unless you multiply the basis function by itself, in which case you get some positive number:

$\displaystyle \int_o^T \phi_n(t) \phi_m^*(t) \, dt = \left\{ \begin{array}{ll} P_n, & n = m \\ 0, & n\neq m \end{array} \right. \hfill (1)$

If $P_n = 1$ for all $n$, then the orthogonal basis is an orthonormal basis.

But this basic set up doesn’t give a lot of hints about good choices for the $\phi_k(t)$. In the representations post, we looked at using impulses and the famous Walsh functions. The latter are appropriate for representing signals that are often constant over significant intervals, or have lots of sharp transitions (step-function-like behavior), because those signal features are reflected in the Walsh functions themselves. But many kinds of signals of interest to us here at the CSP Blog do not possess those properties. Instead, they possess smooth transitions, quasi-periodic components, or even additive sine-wave components.  For these signals, it is reasonable to consider basis functions that are themselves smoothly varying over time (no step functions), rhythmic, or oscillatory. This leads us to consider sine waves for the $\phi_k(t)$.

So we want to use sine waves as our basis, or building-block, functions, but the question is which sine waves do we use?

Consider a complex-valued sine wave on the interval $[0, T]$: $e^{i 2 \pi f_o t}$. Note that this notation (used extensively in my CSP posts) contains two real-valued sine waves “in quadrature:”

$\displaystyle e^{i 2 \pi f_0 t + i \theta} = \underbrace{\cos(2\pi f_0 t + \theta)}_{\substack{In-Phase \\ Component}} + i \underbrace{\sin(2 \pi f_0 t + \theta)}_{\substack{Quadrature \\ Component}} \hfill (2)$

which is Euler’s formula.

Let’s specify the $j$th basis function as

$\displaystyle \phi_j(t) = K_0 e^{i 2 \pi f_0 t} \ \ \ \ t \in [0, T] \hfill (3)$

for some non-zero constant $K_0$. Let some other potential basis function be

$\displaystyle \phi_k(t) = K_1 e^{i 2 \pi f_1 t} \ \ \ \ t \in [0, T] \hfill (4)$

Orthogonality demands that

$\displaystyle \int_0^T \phi_j(t) \phi_k^*(t) \, dt = \left\{ \begin{array}{ll} P_k \neq 0, & j = k \\ 0, & j \neq k \end{array} \right. \hfill (5)$

Let’s explicitly derive the condition on the two basis functions for the case $j \neq k$ (we take this to imply $f_0 \neq f_1$):

$\displaystyle \int_0^T K_0 K_1 e^{i 2 \pi f_0 t} e^{-i 2 \pi f_1 t} \, dt = 0 \ \ \ (f_0 \neq f_1) \hfill (6)$

$\displaystyle \Rightarrow K_0K_1 \int_0^T e^{i 2 \pi (f_0 - f_1) t} \, dt = 0 \ \ \ (f_0 \neq f_1) \hfill (7)$

$\displaystyle \Rightarrow K_0K_1 \left. \frac{e^{i2\pi (f_0 - f_1)t}}{i 2 \pi (f_0 - f_1)} \right\rvert_{t=0}^T = 0 \ \ \ (f_0 \neq f_1) \hfill (8)$

$\displaystyle \Rightarrow \frac{K_0K_1}{i 2 \pi (f_0-f_1)} \left( e^{i2 \pi (f_0 - f_1)T} - 1 \right) = 0 \ \ \ (f_0 \neq f_1) \hfill (9)$

$\displaystyle \Rightarrow \frac{K_0K_1 e^{i2\pi (f_0-f_1)T/2}}{i2\pi (f_0-f_1)} \left( e^{i\pi (f_0-f_1)T} - e^{-i\pi(f_0-f_1)T} \right) = 0 \ \ \ (f_0\neq f_1) \hfill (10)$

$\displaystyle \Rightarrow \frac{K_0K_1 e^{i\pi (f_0-f_1)T}}{\pi(f_0-f_1)} \sin(\pi(f_0-f_1)T) = 0 \ \ \ (f_0\neq f_1) \hfill (11)$

$\displaystyle \Rightarrow K_0K_1 T e^{i\pi(f_0-f_1)T}\mbox{\rm sinc} ((f_0-f_1)T) = 0 \ \ \ (f_0\neq f_1) \hfill (12)$

Recall that $e^{ix}$ can never be zero, since it has magnitude equal to one for all (real) $x$, and that the zeros of the $\mbox{\rm sinc}(x)$ function are the integers except for $x = 0$. therefore, the orthogonality condition (12) holds for all values of $f_1$ for which

$\displaystyle (f_0 - f_1)T = m, \ \ \ m \in \mathbb{Z} \hfill (13)$

which implies that $f_0 - f_1 = m/T$. If we make the simplifying choice of setting the original frequency $f_0$ equal to zero, then the entire set of frequencies that specify the orthogonal set of sine waves on the interval $[0, T]$ are given by

$\displaystyle f_1 = m/T,\ \ \ m \in \mathbb{Z}, \hfill (14)$

that is, all harmonics of the fundamental frequency $1/T$. Choosing $K_0 = K_1 = 1$, our derived set of orthogonal sine-wave basis functions is given by

$\displaystyle \phi_k(t) = e^{i 2 \pi k t/T} \ \ \ t \in [0, T] \hfill (15)$

With the choices we’ve made, is this orthogonal basis an orthonormal basis as well? Let’s check the energy of the $k$th basis function:

$\displaystyle E_k = \int_0^T \left| \phi_k(t) \right|^2 \, dt \hfill (16)$

$\displaystyle = \int_0^T \phi_k(t) \phi_k^*(t) \, dt \hfill (17)$

$\displaystyle = \int_0^T \left( e^{i 2 \pi kt/T}\right) \left(e^{-i2\pi kt/T} \right) \, dt \hfill (18)$

$\displaystyle = \int_0^T e^{i 2 \pi (k - k)t/T} \, dt = \left. t \right\rvert_{o}^{T} = T \hfill (19)$

So, no, it isn’t unless $T = 1$, but at least the energy is the same in each basis function. Using the basic machinery of the orthogonal representation, the complex Fourier series is given by

$\displaystyle s(t) = \sum_{k=-\infty}^\infty c_k e^{i 2 \pi kt/T}, \ \ \ t \in [0, T] \hfill (20)$

where each Fourier coefficient is determined by the integration of the signal multiplied by a conjugated basis function,

$\displaystyle c_k = \frac{1}{T} \int_0^T s(t) e^{-i2 \pi kt/T}\, dt. \hfill (21)$

In general, the representation requires an infinite number of weighted sine waves, but there are lots of signals for which the sum is finite–that is, all the $c_k$ are zero for $|k| > K$. An example is a sine wave with frequency $p/T$.

### Observations on the Fourier Series

A. The Fourier series is valid for almost any signal (function) on a finite interval-it is valid for any physical signal on a finite interval. Mathematicians can conjure non-physical signals for which the series won’t converge.

B. If a signal $s(t)$ is periodic with period $T$, then the Fourier series representation is valid for all time $t$. Choose the interval $[0, T]$ and create the Fourier series representation:

$\displaystyle s(t) = \sum_{k=-\infty}^\infty c_k e^{i 2 \pi k t / T}, \ \ \ t \in [0, T]. \hfill (22)$

Then look at $s(t +T)$

$\displaystyle s(t+T) = \sum_{k=-\infty}^\infty c_k e^{i 2 \pi k (t+T) / T}, \hfill (23)$

$\displaystyle = \sum_{k=-\infty}^\infty c_k e^{i 2 \pi k t / T} e^{i 2 \pi k T/T}, \hfill (24)$

$\displaystyle = \sum_{k=-\infty}^\infty c_k e^{i 2 \pi k t / T} = s(t), \hfill (25)$

because $e^{i 2 \pi k} = 1$ for all integers $k$.

C. If a signal is periodic with period $T$, you can find the Fourier series coefficients for any interval with length $T$. This suggests you choose a particular interval that is convenient for the required integration that defines $c_k$.

D. For real-valued signals $s(t)$, the coefficients $c_k$ obey

$\displaystyle c_{-k} = c_k^* \hfill (26)$

E. For real-valued even periodic signals $s(t)$, the imaginary part of $c_k$ is zero for all $k$.

F. For real-valued odd periodic signals $s(t)$, the real part of $c_k$ is zero for all $k$.

G. The Fourier series is linear. If $s(t)$ has Fourier coefficients $\{c_k\}$, then the Fourier coefficients for $As(t)$ are $\{ Ac_k\}$. If $s_1(t)$ has Fourier coefficients $\{d_k\}$ and $s_2(t)$ has Fourier coefficients $\{b_k\}$, then $s(t) = s_1(t) + s_2(t)$ has Fourier coefficients $\{d_k + b_k\}$. (Here we assume a common period $T$ or integration interval for the two signals.)

H. The Fourier series coefficients for a delayed version of a signal are equal to phase-shifted versions of the undelayed signal. That is, if the signal $s(t)$ has period $T$ and Fourier coefficients $c_k$, then the signal $s(t-D)$ has period $T$ and Fourier coefficients $d_k$, where

$\displaystyle d_k = c_k e^{-i2\pi kD/T}$

Notice that if $D$ is a multiple of $T$, then $c_k = d_k$, which makes sense because the signal is periodic with period $T$, and so $s(t)$ and $s(t-D)$ would be identical in those cases.

I. Interpretation. The Fourier frequencies $k/T$ in the Fourier series representation of a periodic signal $s(t)$ are those frequencies at which the signal possesses non-zero power. (See (10) in the Representations post to see exactly why.) Their values, together with the non-zero strengths $|c_k|$, are referred to as spectral lines. The line spectrum is the graph of these spectral lines, and it indicates the absolute as well as the relative contributions of the individual sine-wave components $\{e^{i 2 \pi (k/T) t}\}$ to the power of $s(t)$.

### Examples of the Fourier Series

#### Rectangular Pulse Train

Suppose we have rectangular pulse train where the pulses have height one and width $U$. A pulse is emitted every $V$ seconds, as shown in Figure 1.

Since $V > U$, then $V/2 > U/2$, and we can conveniently choose to integrate on the interval $[-V/2, V/2]$, which will contain the single rectangle centered at $t = 0$. The Fourier coefficients are derived like this:

$\displaystyle c_k = \frac{1}{V} \int_{-V/2}^{V/2} s(t) e^{-i2\pi (k/V) t} \, dt \hfill (27)$

$\displaystyle = \frac{1}{V} \int_{-U/2}^{U/2} s(t) e^{-i2\pi (k/V) t} \, dt \hfill (28)$

$\displaystyle = \frac{1}{V} \int_{-U/2}^{U/2} (1) e^{-i2\pi (k/V) t} \, dt \hfill (29)$

$\displaystyle = \left. \frac{1}{V} \frac{e^{-i2\pi (k/V) t}}{-i2\pi k/V} \right\rvert_{t=-U/2}^{U/2} \ \ \ (k \neq 0) \hfill (30)$

$\displaystyle = \frac{1}{V} \frac{1}{-i2\pi k/V} \left( e^{-i\pi k U/V} - e^{i \pi k U/V} \right) \hfill (31)$

$\displaystyle = \frac{1}{V} \frac{1}{-i2\pi k/V} \left( -i2 \sin(\pi k U/V) \right) \hfill (32)$

$\displaystyle = \frac{U}{V} \frac{1}{\pi k/(U/V)} \left( \sin(\pi k U/V) \right) \hfill (33)$

$\displaystyle = \frac{U}{V} \mbox{\rm sinc} (kU/V) \hfill (34)$

The integral is easy to evaluate if $k = 0$: we get $U/V$. Since the $\mbox{\rm sinc}(x)$ function is equal to one at $x= 0$, (34) is valid for all $k$. Figure 2 shows some evaluations of (34) for various duty cycles $D$.

When the duty cycle is low, the signal energy is spread over many harmonics (many of the sine-wave basis functions are non-zero). On the other hand, when the duty cycle is high, the energy is concentrated on the low-frequency components near $k = 0$.

#### Impulse Train

Next consider a periodic train of impulse functions as shown in Figure 3.

We can write the periodic signal $s(t)$ as

$\displaystyle s(t) = \sum_{k=-\infty}^\infty A \delta(t - kT) \hfill (35)$

The period is $T$, and we can conveniently choose the interval $[-T/2, T/2]$ over which to integrate to find the Fourier coefficients $c_k$:

$\displaystyle c_k = \frac{1}{T} \int_{-T/2}^{T/2} s(t) e^{-i 2 \pi k t/T} \, dt \hfill (36)$

$\displaystyle = \frac{1}{T} \int_{-T/2}^{T/2} A \delta(t) e^{-i 2 \pi k t/T} \, dt \hfill (37)$

$\displaystyle = \frac{1}{T} \int_{-T/2}^{T/2} A \delta(t) e^{-i 2 \pi k 0/T} \, dt \hfill (38)$

$\displaystyle = \frac{A}{T} \int_{-T/2}^{T/2} \delta(t) \, dt \hfill (39)$

$\displaystyle = \frac{A}{T} (1) \hfill (40)$

$\displaystyle = \frac{A}{T} \hfill (41)$

So we see that the Fourier coefficients are all equal for this unusual periodic waveform. Since it is periodic, the Fourier series is valid for all $t$, and we obtain the following useful identity:

$\displaystyle s(t) = \sum_{k=-\infty}^\infty A \delta(t - kT) = \frac{1}{T} \sum_{k=-\infty}^\infty A e^{i 2 \pi k t/T} \hfill (42)$

Notice that the rectangular pulse train with low duty cycle has similar Fourier coefficients-that signal is more like the impulse train than the high duty cycle signal, which is more like a constant signal.

#### Decaying Exponential Pulse Train

Suppose we have a periodic signal that consists of a decaying exponential function on each period, as illustrated in Figure 4.

On the interval $[0, T]$ the signal takes the form $Ae^{-at}$, where both $A$ and $a$ are positive real numbers. If you crunch through the integral, you should obtain the Fourier coefficients given by

$\displaystyle c_k = \frac{A(1-e^{-aT})}{(i2\pi k + aT)} \hfill (43)$

It is instructive to examine that formula for the cases of small $a$ and large $a$. What might you expect in each case, given what we’ve already uncovered? When $a$ is large, the exponential decays to zero rapidly, and the exponential pulse train resembles the impulse train. On the other hand, when $a$ is small, the exponential decays very little over each interval, and the signal resembles a constant or a high duty cycle rectangular pulse train.

#### Even Square Wave

The even square wave is shown in Figure 5. We could perform the integration to find the $c_k$, but it is easier to use some of the Fourier series properties to find the coefficients using the coefficients for signals we have already analyzed.

In particular, the even square wave can be viewed as the sum of two distinct rectangular pulse trains, as shown in Figure 6.

Using our previously derived formula for the $c_k$ for a rectangular pulse train with $U = T/2$ and $V = T$, we have the coefficients $d_k$ for $s_1(t):$

$\displaystyle d_k = A (\frac{T/2}{T}) \mbox{\rm sinc} ((kT/2)/T) = \frac{A}{2} \mbox{\rm sinc}(k/2) \hfill (44)$

We can use the shifting or delay property of the Fourier series (property H above) to obtain the coefficients $b_k$ for $s_2(t)$:

$\displaystyle b_k = d_k e^{-i \pi k} \hfill (45)$

The coefficients $c_k$ for $x(t)$ are then

$c_k = d_k - b_k = d_k (1-e^{-i\pi k}) = \frac{A}{2} \mbox{\rm sinc}(k/2) (1 - e^{-i\pi k}) \hfill (46)$

#### Odd Square Wave

The odd square wave is shown in Figure 7, and we can view it as a delayed (time shifted) version of the even square wave, or we could decompose it into the combination of a couple rectangular pulse trains. If the former, we recognize that the delay is $D = T/4$.

The Fourier coefficients $g_k$ are then given by

$\displaystyle g_k = \frac{A}{2} \mbox{\rm sinc}(k/2) (1 - e^{-i\pi k}) e^{-i2\pi kD/T} \hfill (47)$

$\displaystyle = \frac{A}{2} \mbox{\rm sinc}(k/2) (1 - e^{-i\pi k}) e^{-i\pi k/2} \hfill (47)$

### Significance of the Fourier Series in CSP

The central dogma of cyclostationary signal processing is that the autocorrelation function is periodic in the time variable $t$ for some significantly large set of delays $\tau$. As we’ve seen in our SPTK posts, periodic functions can always be represented by the Fourier series. In CSP we have the periodically time-varying autocorrelation function $R_x(t, \tau)$, and so it can be expressed as the following series

$\displaystyle R_x(t, \tau) = \sum_{k=-\infty}^\infty c_k e^{i 2 \pi (k/T) t} \hfill (48)$

where $T$ is the period of $R_x(t, \tau)$. Considering $\tau$ as a fixed parameter, it is clear that the Fourier coefficient $c_k$ is going to depend on $\tau$. To emphasize the special nature of the Fourier frequency $k/T$ as it relates to the cyclic nature of the autocorrelation function, we use the name cycle frequency for the Fourier frequency, $\alpha = k/T$.

In keeping with the normal autocorrelation notation involving capital R, we simply rename $c_k$ as

$\displaystyle c_k = R_x^\alpha(\tau) \hfill (49)$

and call it the cyclic autocorrelation. And so the commonly encountered relation between the time-varying autocorrelation and the cyclic autocorrelation

$\displaystyle R_x(t, \tau) = \sum_\alpha R_x^\alpha(\tau) e^{i 2 \pi \alpha t} \hfill (50)$

and

$\displaystyle R_x^\alpha(\tau) = \frac{1}{T} \int_{-T/2}^{T/2} R_x(t, \tau) e^{-i 2 \pi \alpha t}\, dt \hfill (51)$

is nothing more than the Fourier series with rebranded Fourier frequencies and Fourier coefficients.

This same analysis holds for periodic higher-order temporal moment and cumulant functions, leading to the cyclic temporal moment and cumulant functions and higher-order pure and impure cycle frequencies.

I'm a signal processing researcher specializing in cyclostationary signal processing (CSP) for communication signals. I hope to use this blog to help others with their cyclo-projects and to learn more about how CSP is being used and extended worldwide.

## 2 thoughts on “SPTK: The Fourier Series”

1. Brandon Hamschin says:

Minor Minor Minor comment:

In the sentence “For these signals, it is reasonable to consider basis functions that are themselves smoothing varying over time” in the first full paragraph below Equation (1), I think you mean *smoothly* varying instead of *smoothing* varying.

Nicely written. You developed this very, very smoothly 🙂

-Brandon