EEET2486 - Laboratory 1 - Guide - S2 - 2020

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

School of Science and Technology

EEET2486 - Signals and Systems 1

Laboratory Exercise 1
Signals and Spectra

EEET2486 – Signals and Systems 1 (Laboratory 1)


1
School of Science and Technology

Laboratory Exercise 1: Signals and Spectra

Learning Outcomes
Upon successful completion of this laboratory exercise you will
be able to:
 Recognise the spectrum of periodic and aperiodic
waveforms and explain the process of generating
these.

 Describe the relationship between the
periodic waveforms generated and their
Fourier series.

 Describe the relationship between the aperiodic
waveforms generated and their Fourier transforms.

 Recognise the limitations of the Fourier transform.

Introduction to the laboratory


Fourier analysis techniques are essential in signal processing to
determine the frequencies that make up various types of signals.
The two most common methods used to decompose a signal
into its constituent frequency components are:
- The Fourier series, used in the analysis of periodic
signals, and
- The Fourier transform, used in a more general sense
to analyse both periodic and aperiodic signals.
In digital signal processing (DSP) an algorithm called the Fast
Fourier Transform (FFT) is used to perform Fourier
transforms on digital signals, this algorithm was a huge
breakthrough in computing as its development allowed for
efficient Fourier analysis to be performed on all types of digital
signals.
This lab is going to firstly look at periodic and non-periodic
signals and examine how to apply Fourier techniques to these
signals to extract frequency information. Since MATLAB is a
digital system this lab will also look at how the fft() function
can be used to perform Fourier analysis on these different
types of signals in a digital environment.

EEET2486– Signals and Systems 1 (Laboratory 1) 2


School of Science and Technology

Part 1: The Fourier series (Periodic signals)


Part 1 of this lab will examine how we can analyse periodic waveforms
using the Fourier series.
Periodic waveforms repeat at regular intervals, or periods, which is
often shown mathematically as T0. These signals could be simple
waveforms such as sinusoids and complex exponentials or more
complex waveforms such as triangle, sawtooth or square-waves.
Periodic signals can be analysed using Fourier series analysis
which breaks a periodic signal down into its constituent elements:
This can be converted to trigonometric form by using the Euler formula
so we can represent the signal as a sum of sinusoids and/or
cosinusoids:

EEET2486 – Signals and Systems 1 (Laboratory 1)


3
School of Science and Technology

Task 1 – Generating waveforms using Fourier series synthesis

Learning outcomes:
- Mathematically apply the Fourier series to odd and even functions to
extract their Fourier coefficients
- Utilise loops in MATLAB to synthesise odd and even functions
- Explain how the Fourier series of odd and even functions differ and
why

Exercise:
A person has a system consisting of a bank of 8 oscillators as shown in
figure 1:

Figure 1: A system consisting of a bank of 8 sinusoidal oscillators

This system behaves as follows:


- It can generate 8 real (co)sinusoidal tones with frequencies
within the audible range of 20 – 20,000 Hz.
- It has a gain for each (co)sinusoid which can be used to weight the
amplitudes of each tone, and
- It has an adder which will add all the 8 tones together to produce a
new waveform y(t) which will be a sum-of-(co)sinusoids.

EEET2486 – Signals and Systems 1 (Laboratory 1)

4
School of Science and Technology

Figure 2 shows the two periodic, square waveforms our person wants to
synthesise using this system. The first waveform is an ‘odd’ function while
the second waveform is identical in amplitude and frequency but is an ‘even’
version of the function:

Figure 2: Two square waveforms to be synthesised, top graph is an


odd function, bottom graph is an even function

Begin by calculating manually(using Fourier series analysis) the frequencies,


phases and amplitudes (weights, ak) of the first 8 harmonically related
(co)sinusoids that could be added together to synthesise these two square
waveforms.

Hints:
- Look at how the trigonometric Fourier series of odd and even functions
differ, this is explained on page 3 of this lab guide.
- Use Euler’s formulae to convert from the exponential to trigonometric
form of the Fourier series to take into account the oscillators in the
system can only produce REAL sinusoids/cosinusoids (not complex
exponentials).

In MATLAB, write a script that simulates the synthesiser system in figure 1.


Plot the two signals that have been synthesised using this system.

EEET2486 – Signals and Systems 1 (Laboratory 1)


5
School of Science and Technology

Set the following simulation parameters in your MATLAB script:


fs = 44100; % Sampling rate (44100 is CD quality)
Ts = 1/fs; % Step-size (resolution) of simulation
t = 0:Ts:2-Ts; % 2 second time array

Use for-loops in MATLAB to add the 8 trigonometric functions together to


form the two square waves.

You can also listen to your synthesised signals using the soundsc()
function to play back the waveforms through your computer’s speakers.

Reflection:
- Which harmonics are contained in these signals? Are they
odd harmonics, even harmonics or both?
- Discuss your observations of the synthesised waveforms.
Contrast the shapes of the synthesised signals with the original ones in
figure 2.
- How many harmonics would need to be added to produce a perfect
square-wave?
- Explain why the odd function is synthesised by a sum of only
sinusoids while the even function is synthesised with only cosines.

Part 2: The Fourier Transform (Aperiodic signals)


Part 2 of this lab will examine how we can use the Fourier transform
to analyse aperiodic waveforms.
Aperiodic waveforms don’t exhibit the repetition we’ve seen so far in
part 1 of this lab and as such cannot be analysed (or synthesised) using
the Fourier series. In these cases a method called the Fourier Transform
must be used to show the frequency content of these types of signals:

In digital systems, including computers and microprocessors, this


process can be performed using a version of the discrete Fourier
transform called the Fast Fourier Transform (FFT). Since MATLAB
is such a system the following tasks will require you to use the fft()
function in MATLAB to do this.

EEET2486 – Signals and Systems 1 (Laboratory 1)


6
School of Science and Technology

Task 2 – The Fourier Transform: Periodic Signals

Learning outcomes:
- Utilise the fft() function in MATLAB to perform a Fourier transform
on periodic waveforms
- Correctly plot the spectrum of periodic signals using MATLAB
- Explain how the Fourier series coefficients and the Fourier
transform relate to each other

Exercise:
While the focus for part 2 of this lab is aperiodic signals, the Fourier
Transform is a general transform that will work on both periodic and aperiodic
signals, so we’ll start by looking at its behaviour with periodic signals first.

For this task perform a Fourier transform on a sinusoid and the periodic
square wave from part 1 using the fft() function in MATLAB:
x1 = cos(800*pi*t); % A single-frequency tone
x2 = 1.5*square(500*pi*t, 50); % square wave from part 1

Plot the magnitude spectra of these (see syntax in Table I: abs(x)).

Label your x and y axes appropriately for these 2 graphs.

Also select an appropriate axes range to present your spectra clearly in


your report.

Hints:
- You will need to set up a frequency array in MATLAB to plot the
magnitude spectra against.
- Typically this should appear as the highlighted code appended to
your code from part 1 as follows:

fs = 44100; % Sampling rate (44100 is CD quality)


Ts = 1/fs; % Step-size (resolution) of simulation
t = 0:Ts:2-Ts; % 2 second time array
N = length(t); %length of time array
F = fs/N; %Frequency step-size
f = (-fs/2):F:(fs/2)-F; %Your new frequency array!!!!!

EEET2486 – Signals and Systems 1 (Laboratory 1)


7
School of Science and Technology

Reflection:
- Compare the magnitudes of the spikes appearing in the magnitude
spectra for the square-wave to the Fourier series coefficients (weights,
ak) you calculated in part 1. They should match.
- What do these graphs tell you about the information the Fourier
transform gives you for periodic signals? How are sinusoids (and
sums-of-sinusoids) represented on a spectral graph? Why?

Task 3 – The Fourier Transform: Chirp Signals

Learning outcomes:
- Mathematically use the instantaneous frequency formula to help
construct chirp signals in MATLAB
- Utilise the fft() function in MATLAB to perform a Fourier transform
on a chirp signal
- Correctly plot the spectrum of aperiodic signals using MATLAB
- Explain how the Fourier transform and the spectrum represents the
frequency content of aperiodic signals

Exercise:
A chirp is an aperiodic waveform that linearly increases/decreases in
frequency over time. A chirp can be mathematically given by the following
equation:

Where f0 is the initial frequency of the chirp and µ is a term (sometimes


called the modulation index) which determines the rate in which the
frequency changes over time (µ can be a positive or negative number
depending on whether the chirp increases or decreases in frequency
over time).

In MATLAB create a 5 second chirp signal that starts at 400 Hz and ends at
1000 Hz. You will need to calculate the value of µ using the instantaneous
frequency discussed.

Use the fft() function to find the Fourier transform of this signal and plot its
magnitude spectrum (see syntax in Table I: abs(x)).

EEET2486 – Signals and Systems 1 (Laboratory 1)


8
School of Science and Technology

Reflection:
- What does the spectrum tell you about the frequency content of chirp
signals?
- Repeat this task for the case where the frequency is decreasing from
2000 to 200 Hz. Does the spectrum make it easy to see that the chirp
is decreasing or increasing in frequency?
- Think about ways we could make it clearer to see that a chirp’s
frequency is increasing or decreasing. Have a look at ‘time-frequency
analysis’ and the ‘spectrogram’ to get an idea on how we can improve
Fourier analysis in the case of non-stationary signals.

Task 4 – The Inverse Fourier Transform

Learning outcomes:
- Utilise the ifft() and ifftshift() functions in MATLAB to
perform an inverse Fourier transform on a sinc function.
- Correctly plot the spectrum and the time-domain waveform of this
signal using MATLAB
- Explain how to apply a time-shift to a Fourier transform (using the
time-shift property) and correctly invert this into the time-domain.

Exercise:
Consider the Fourier transform pair for a box function (which could be
produced in a system by a switch turning on for a second):

In this case we may only have the spectrum of the signal X(f) and want to
find the time-domain signal.

In MATLAB generate your time and frequency arrays again, since the signal
x(t) will start in negative time (starts at -0.5 sec) change your time-array so it
starts at -2 seconds and ends at +2 seconds (keep the time-step, etc the
same as previously).

EEET2486 – Signals and Systems 1 (Laboratory 1)


9
School of Science and Technology

Generate and plot the spectrum of this signal (X(f)) using the sinc()
function. Use the ifft() function to now find the inverse Fourier transform of
this signal and plot it in the time-domain (see syntax in Table I: ifft(X)).

Reflection:
- Describe what you are seeing in the time-domain, explain any
inaccuracies you are seeing and why this is the case (Hint: Think of the
finite nature of MATLAB).
- Consider the time-shift property of the Fourier transform. Generate
a new function X(f) in MATLAB that will now cause the result of the
IFFT process to be the same function as previously (x(t)) shifted by 1
second i.e.:

- Explain the time-shift property of the Fourier transform and particularly


the phase term that appears in the FT.

EEET2486 – Signals and Systems 1 (Laboratory 1)

10
School of Science and Technology

EEET2486 – Signals and Systems 1 (Laboratory 1)


11
School of Science and Technology

EEET2486 – Signals and Systems 1 (Laboratory 1)


12
School of Science and Technology

EEET2486 – Signals and Systems 1 (Laboratory 1)


13
School of Science and Technology

EEET2486 – Signals and Systems 1 (Laboratory 1)


14

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy