Representation of Periodic Signals. Fourier Series

Introduction
In this section representation of periodic signals by means of Fourier series will be considered. Fourier series are a basis of the Fourier transform theory and the spectral analysis therefore Fourier transform of a nonperiodic signal can be received as Fourier series limit at the infinite repetition period. As a result, properties of Fourier series are also correct for Fourier transform of nonperiodic signals.
We will consider the equation for Fourier series in the trigonometric and complex form and we will also pay our attention to Dirichlet conditions of Fourier series convergence. We will also explain in detail such a concept as negative frequency of a signal spectrum which is often a special issue in case of the first familiarity with the spectrum analysis theory.
Periodic Signal. Trigonometric Fourier Series
Let’s suppose there is a periodic signal of the continuous period which repeats with the period seconds, i.e. . As an example the periodic rectangular pulse signal is shown in Figure 1.

Figure 1. Example of the Periodic Rectangular Pulse Signal
The mathematical analysis course gives us the notion [1] that the trigonometric function system with multiple frequencies
 (1)
(1)
forms the orthonormal basis to expand any periodic signals with the period for which Dirichlet condition is met [1]. Dirichlet conditions of Fourier series convergence demand the signal to be set in the segment , the signal has to be limited (it hasn’t to have infinite values), has to be piecewise continuous, i.e. has to have the finite number of Type I discontinuities (jumps and removable discontinuities), and has to be piecewise monotonic, i.e. has to have the finite number of extrema. Thus, for example, the periodic function does not meet Dirichlet conditions because the function has Type II discontinuities and takes on infinite values at where Thus, the function cannot be represented by Fourier series. It is also possible to give an example of the function which is limited but also does not meet Dirichlet conditions as it has the infinite number of extreme points at the zero approach of . The diagram is shown in Figure 2.
Figure 2. Diagram
In the upper diagram there is shown two periods of the function repetition and in the bottom one there is shown an area in the period It is possible to see that in case of the zero approach of oscillation frequency increases infinitely, and such function cannot be also represented by Fourier series
It should be noted that in practice there are no signals with infinite current or voltage values. There are no functions with the infinite number of extrema like in applied problems.
All real periodic signals, for example, periodic rectangular pulse signals shown in Figure 1 meet Dirichlet conditions and can be represented by an infinite trigonometric Fourier series of the form:
 (2)
(2)
In equation (2) the coefficient sets the mean value of a periodic signal.
At all points where the signal is continuous Fourier series (2) converges to values of this signal, and at Type I discontinuities it converges to the average value , where and are limits on either side of a discontinuity.
The mathematical analysis course also gives us the notion [1] that using only Fourier series members instead of the infinite sum leads to approximate representation of the signal
 (3)
(3)
at which the mean square error minimum is provided. Animation 1 illustrates approaching the periodic rectangular pulse signal when using the various number of Fourier series members.
Animation 1. Approaching the Truncated Series to the Periodic Rectangular Pulse Signal.
Fourier Series in the Complex Form.
In the previous section we have considered the trigonometric Fourier series for expanding any periodic signal meeting Dirichlet conditions. However, it is not the only representation which can be used for periodic signals.
Having applied the Euler’s formula to complex numbers, it is possible to show that:
 (4)
(4)
Then the trigonometric Fourier series (2) taking into account (4) is
 (5)
(5)
Thus, the periodic signal can be represented by the sum of the mean value and complex exponents rotating with frequencies with complex coefficients for positive frequencies of complex exponents and for complex exponents rotating with negative frequencies .
Consider coefficients for complex exponents rotating with positive frequencies :
 (6)
(6)
Similar to the previous coefficients for complex exponents rotating with negative frequencies:
 (7)
(7)
Equations (6) and (7) match, in addition to it the coefficient of the mean value can be also represented by means of a complex exponent with zero frequency:
 (8)
(8)
Thus, taking into account (6)-(8) it is possible to represent (5) as the unified sum upon indexing from minus infinity to infinity:
 (9)
(9)
Equation (9) represents Fourier series in the complex form. Fourier series coefficients in the complex form are connected to series coefficients in the trigonometric form and they are defined either for positive or for negative frequencies. We set the coefficient as the function depending on frequency because this coefficient corresponds to the frequency
It follows from equation (2) that for the real-valued signal coefficients and of the series (2) are also real-valued. Then it follows from (9) that complex coefficients which are appropriate to positive frequencies are conjugate coefficients for negative frequencies if is real-valued.
Some Explanations to Fourier Series in a Complex Form.
In the previous section we have implemented transition from the trigonometric Fourier series to the Fourier series in the complex form. As a result instead of expanding periodic signals in the base of real-valued trigonometric functions we have received expanding in the base of complex exponents with complex coefficients , moreover negative frequencies have appeared upon expanding! As the matter is often unclear it is necessary to give some explanations.
Firstly, it is simpler to work with complex exponents, in most cases it is simpler than with trigonometric functions. For example, upon multiplying (dividing) complex exponents it is enough only to sum up (to subtract) indicators while formulas of multiplying (dividing) trigonometric functions are more lengthy.
It is also simpler to differentiate and integrate exponents (even if they are complex) than trigonometric functions which are constantly changing when differentiating and integrating (sine turns into cosine and vice versa).
Secondly, it is more convenient to use the series in the complex form either for real-valued or for complex signals. If the signal is periodic and real-valued, then the trigonometric Fourier series seems more evident because all the coefficients of expanding and remain real-valued. However, it is often necessary to deal with complex periodic signals (for example, in case of modulation and demodulation they use complex envelope in-phase and quadrature components). In this case when using the trigonometric Fourier series all the coefficients of expanding and will become also complex while when using the Fourier series in the complex form only complex coefficients of expanding either for real-valued and for complex input signals will be used.
And at last, it is necessary to dwell on explaining negative frequencies which have appeared in (5) and (9). This question often causes the greatest misunderstanding.
In everyday life we do not face negative frequencies. For example, we never arrange a radio-receiving set for negative frequency. Consider the following analogy from mechanics.
Let’s suppose there is a spring pendulum which oscillates in a free way with some frequency Can the pendulum oscillate with negative frequency ? Of course not, there are no radio stations goes on air on negative frequencies, and the pendulum oscillation frequency cannot be the negative either. But it does not mean that the concept of negative frequency is deprived of any sense.
It is necessary to note that the considered spring pendulum is a one-dimensional object (the pendulum oscillates along one straight line). But we can also give one more analogy from mechanics. i.e. a wheel rotating with the frequency . The wheel in contrast to the pendulum rotates, i.e. the point at the wheel surface moves in plane, but not just oscillates along one straight line. Therefore to set wheel rotation in a single-valued way it is not enough to set the rotating speed because it is necessary to set the rotation direction. For this purpose we can also use the frequency index.
So if the wheel rotates with the frequency rad/s in a countraclockwise way, then we consider that the wheel rotates with the positive frequency and if in a clockwise direction then the rotating speed will be negative. Thus, to set the rotation the negative frequency stops being nonsense and it specifies the rotation direction.
Now the most important thing which we have to understand. Oscillation of a one-dimensional object (for example, the spring pendulum) can be represented as the sum of rotations of two vectors as it is illustrated by Animation 2.
Animation 2. Oscillation of the Spring Pendulum as the Sum of Rotations of Two Vectors in the Complex Plane.
The pendulum oscillates along the real-valued axis of the complex plane with the frequency according to the harmonic law . The pendulum position is shown by the green vector. The red vector rotates in the complex plane with the positive frequency (in a countraclockwise way), and the blue vector rotates with the negative frequency (in a clockwise direction). Animation 2 visually illustrates the ratio which is well-known from Trigonometry:
 (10)
(10)
Thus, Fourier series in the complex form (9) represents periodic one-dimensional signals as the sum of vectors in the complex plane which rotate with positive and negative frequencies. At the same time we will pay our attention to the fact that in case of the real-valued signal according to (9) the coefficients of expanding for negative frequencies are complex conjugate and they correspond to coefficients for positive frequencies. In case of the complex signal this property of coefficients is not executed in view of the fact that and are also complex.
Spectrum of Periodic Signals
Fourier series in the complex form represents expanding the periodic signal into the sum of complex exponents rotating with positive and negative frequencies which are multiple of with appropriate complex coefficients which define the signal spectrum . At the same time complex coefficients can be represented according to Euler’s formula as where is an amplitude signal spectrum, is a phase spectrum. As periodic signals are expanded into the series only in the fixed frequency spectrum , then the spectrum of periodic signals are linear (discrete). In Figure 3 there is an example of the amplitude and phase spectrum of the periodic rectangular pulse signal (see Figure 1 at sec and the pulse amplitude is equal to 2).

Figure 3. Example of the Amplitude and Phase Spectrum of the Periodic Rectangular Pulse Signal
The amplitude spectrum of the original real-valued signal is symmetric with respect to the zero frequency, and the phase spectrum is antisymmetric. At the same time we will note that values of the phase spectrum and correspond to the same point of the complex plane . I.e. it is possible to draw a conclusion that all expanding coefficients of the given signal are pure real-valued, and the phase spectrum corresponds to negative coefficients .
The script realizing calculating the data for plotting Figure 3 is given in fourier_series_spectrum.py.
					
# -*- coding: utf-8 -*-
"""
Скрипт расчета данных для построения рисунка 3 раздела
Представление периодических сигналов. Ряд Фурье.
@author: Бахурин Сергей
www.dsplib.org
"""
import numpy as np

# Период повторения сигнала
T = 4.0
P = 8000

# Количество коэффициентов ряда Фурье
N =20

# максмимальное количество коэффициентов ряда Фурье
M = np.max(N)

def pimp_signal(t, T, A, Q):
"""
Функция генерации последовательности прямоугольных импульсов
t - массив временных отсчетов
T - период повторения
A - Амплитуда импульсов
Q - коэффициент заполнения (от 0 до 1)
"""
t0 = t - np.round(t/T)*T
s = np.zeros(len(t), dtype = 'float64')
for ind in range(len(t0)):
if(np.abs(t0[ind]) < T/2 * Q):
s[ind] = A
return s

# Один период повторения
t = np.linspace(-T/2, T/2, num = P, endpoint=False)
s = np.zeros(P, dtype='float64')
s = pimp_signal(t, T, 2.0, 0.5)

# Расчет к-тов усеченного ряда Фурье в комплексной форме
#            M
#   s(t) =  SUM c_n * exp(j*w*t)
#           n=-M
c = np.zeros(N*2+1, dtype = 'complex128')
w = np.zeros(N*2+1, dtype = 'float64')
for n in range (-N, N+1):
w[n+N] = 2.0*np.pi / T * n
c[n+N] = np.trapz(s * np.exp(-1j * w[n+N] * t), t) / T

amp = np.abs(c)
phi = np.angle(c)

# сохранение в соответсвующий файл csv
fn = "dat/fourier_series_spectrum_amp.csv"

np.savetxt(fn, np.transpose([w, amp]), fmt="%+.9e")

# сохранение в соответсвующий файл csv
fn = "dat/fourier_series_spectrum_phi.csv"
np.savetxt(fn, np.transpose([w, phi]), fmt="%+.9e")

"""
import matplotlib.pyplot as plt

plt.figure(1)
plt.stem(w/np.pi,amp)

plt.figure(2)
plt.stem(w/np.pi,phi/np.pi)

plt.show()
"""



Conclusions
In this section representation of periodic signals by means of Fourier series is considered. Equations for Fourier series are given in trigonometric and complex forms. We have paid our special attention to Dirichlet conditions of Fourier series convergence and there are also given examples of functions for which Fourier series falls apart.
In more detail we have dwelled on the equation of Fourier series in the complex form and showed that either real-valued or complex periodic signals are represented by the series of complex exponents with positive and negative frequencies. At the same time expanding coefficients are also complex and they characterize the amplitude and phase spectrum of the periodic signal.
In the following section we will consider properties of spectrums of periodic signals in more detail.
References
[1] Воробьев Н.Н. Теория рядов. Москва, Наука, Главная редакция физико-математической литературы, 1979.

[2] Каханер Д., Моулер К., Нэш С. Численные методы и математическое обеспечение. Москва, Мир, 1998.

[3] Баскаков С.И. Радиотехнические цепи и сигналы Москва, Высшая школа, 2000.

[4] Гоноровский И.С. Радиотехнические цепи и сигналы Москва, Сов. радио, 1977.

[5] Folland G.B. Fourier Analysis and its Applications Belmont, Wadsworth& Brooks, 1992.

[6] Бесов О.В. Тригонометрические ряды Фурье. Учебно-методическое пособие (для студентов 2-го курса). Москва, МФТИ, 2004. [PDF]