Experiment 10
Experiment 10
Experiment 10
Equipment required:
• MATLAB installed on PCs
Background Knowledge:
A Fourier series is a way of representing a periodic function as a sum of sine and cosine functions. It is a
periodic function composed of harmonically related sinusoids, combined by a weighted summation. With
appropriate weights, one cycle of the summation can be made to approximate an arbitrary function in that
interval. Instead of representing the signal amplitude as a function of time, Fourier series represents the
signal by how much information is contained at different frequencies.
Periodic Signals:
A signal is said to be periodic if it satisfies the following condition:
𝑥(𝑡) = 𝑥(𝑡 + 𝑎𝑇)
or
𝑥(𝑛) = 𝑥(𝑛 + 𝑎𝑁)
where a=0,1,2,3,4…… and T and N are the fundamental time periods in continuous and discrete domains.
In other words, A periodic signal remains unchanged with a time shift ‘T’. Sinusoidal signals are the basic
example of periodic signals.
Fundamental Period:
The minimum value of T which satisfies 𝑥(𝑡) = 𝑥(𝑡 + 𝑎𝑇) is called the fundamental period of the signal
It is the smallest positive value for which the equations of periodicity hold. It is denoted by 𝑇0 for continuous
periodic signals and 𝑁0 for discrete periodic signals.
Harmonics:
The term harmonics is typically applied to repeating signals, such as sinusoidal waves. A harmonic of a
wave is a wave with a frequency that is a positive integer multiple of the frequency of the original wave,
known as the fundamental frequency. The original wave is also called the 1st harmonic, the following
harmonics are known as higher harmonics.
Consider a sinusoidal signal 𝑠𝑖𝑛(𝜔0 𝑡) where 𝜔0 is the fundamental frequency of this sinusoid. The higher
harmonics for this sinusoid are 𝑠𝑖𝑛(2 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(3 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(4 ∗ 𝜔0 𝑡) etc. 𝑠𝑖𝑛(𝜔0 𝑡) is the fundamental
harmonic while 𝑠𝑖𝑛(2 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(3 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(4 ∗ 𝜔0 𝑡) etc. are higher harmonics of the fundamental
harmonic.
Even and Odd Harmonics:
If the harmonic of a signal has an even co-efficient it is called an even harmonic and if the co-efficient is
odd, it is called an odd harmonic. For example, let 𝑥(𝑡) = 𝑠𝑖𝑛(𝜔0 𝑡), then:
𝑠𝑖𝑛(2 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(4 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(6 ∗ 𝜔0 𝑡) ----------------------------------- Even Harmonics
𝑠𝑖𝑛(3 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(5 ∗ 𝜔0 𝑡), 𝑠𝑖𝑛(7 ∗ 𝜔0 𝑡)----------------------------------- Odd Harmonics
Fourier Series:
The Fourier series is a representation of a periodic signal 𝑥(𝑡) in terms of complex exponentials or sinusoids
of frequency multiples of the fundamental frequency of 𝑥(𝑡). The advantage of using the Fourier series to
represent periodic signals is not only the spectral characterization obtained, but in finding the response for
these signals when applied to LTI systems. Mathematically, the Fourier series is an expansion of periodic
signals in terms of normalized orthogonal complex exponentials.
There are two types of Fourier series representations:
1. Complex Exponential Fourier series Representation
2. Trigonometric Fourier series Representation
𝑥(𝑡) = ∑ 𝑎𝑘 𝑒 𝑗𝑘𝑤0 𝑡
𝑘= −∞
𝑇
2
𝑏𝑘 = ∫ 𝑥(𝑡) sin 𝑘𝑤0 𝑡 𝑑𝑡
𝑇0
𝑇0
Fourier Series Representation of Discrete Time Signals:
Complex Exponential Fourier series Representation:
The complex exponential Fourier series representation of a periodic signal 𝑥[𝑛] with fundamental period
𝑁 is given by:
∞
𝑥[𝑛] = ∑ 𝑎𝑘 𝑒 𝑗𝑘𝑤0 𝑛
𝑘= <𝑁>
Example:
Consider the following function 𝑥(𝑡) where:
𝑡 − 𝜋 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 2𝜋
𝑥(𝑡) = {
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Calculate the Fourier series coefficients (𝑎𝑘 , 𝑏𝑘 and 𝑎0 ). Use these coefficients to approximate 𝑥(𝑡).
Theoretical Calculations:
When the given function is extended periodically, its period will be T = 2π. The corresponding frequency
is therefore 𝜔 = 1. While substituting this function into appropriate formulas, two of the three integrals have
to be evaluated using integration by parts.
Thus, we get:
This problem can be solved in MATLAB using Symbolic Toolkit. The following code generates the Fourier
coefficients and reconstruct the signal.
Realization of periodic signal decomposition with MATLAB based on Fourier series:
The Fourier series representation of the given square wave is:
∞
4
𝑥(𝑡) = ∑ sin (𝑛𝜔0 𝑡)
𝑛𝜋
𝑛=1,3,5..
By increasing the number of harmonics, the Fourier series can be used to approximate the original square
wave. The code given below is used to realize the square wave by using its Fourier series representation.
As more terms are added together the approximation over the flat, continuous part of the square wave
improves. However, the approximation is always poor close to the discontinuity. This is called Gibbs
phenomenon and is caused by approximating a discontinuous function with a finite series of continuous
functions. It is the peculiar manner in which the Fourier series of a piecewise continuously differentiable
periodic function behaves at a jump discontinuity. The nth partial sum of the Fourier series has large
oscillations near the jump, which might increase the maximum of the partial sum above that of the function
itself. The overshoot does not die out as n increases but approaches a finite limit.
Lab Tasks:
1. Consider the given function 𝑥(𝑡) where:
𝑥(𝑡) = 𝑡 2 𝑓𝑜𝑟 − 1 ≤ 𝑡 ≤ 1
Calculate the Fourier series coefficients (𝑎𝑘 , 𝑏𝑘 and 𝑎0 ) using MATLAB. Use these coefficients
to approximate 𝑥(𝑡).
2. Consider the following periodic signal:
∞
4
𝑥(𝑡) = ∑ sin(𝑘 ∗ 𝜔 ∗ 𝑡)
𝑘∗𝜋
𝑘=1
Use MATLAB to plot the results up to 𝑘 = 15, take 𝑤 = 2𝜋 and t = 0:0.01:5. Increase 𝑘 up to 1000
and see the effect. Explain the effect.
3. Find the Fourier series for the given triangle wave defined on the interval [-𝜋, 𝜋]
𝜋
+ 𝑥 𝑓𝑜𝑟 − 𝜋 ≤ 𝑥 ≤ 0
𝑥(𝑡) = {2 𝜋
− 𝑥 𝑓𝑜𝑟 0 ≤ 𝑥 ≤ 𝜋
2
Calculate the Fourier series coefficients (𝑎𝑘 , 𝑏𝑘 and 𝑎0 ) using MATLAB. Use these coefficients
to approximate 𝑥(𝑡). Plot your results. Compare these results with theoretical calculations.
4. Find the Fourier series for the given function:
Calculate the Fourier series coefficients (𝑎𝑘 , 𝑏𝑘 and 𝑎0 ) using MATLAB. Use these coefficients
to approximate 𝑓(𝑥). Plot the results. Compare these results with theoretical calculations.
[Hint: The central segment is 𝑓(𝑥) = 𝑥 𝑓𝑜𝑟 − 𝐿 < 𝑥 < 𝐿 and 𝑓(𝑥) = 𝑥 − 2𝐿 𝑓𝑜𝑟 𝐿 < 𝑥 < 3𝐿 and
so on.]
Conclusion: