EEET2486 - Laboratory 1 - Guide - S2 - 2020
EEET2486 - Laboratory 1 - Guide - S2 - 2020
EEET2486 - Laboratory 1 - Guide - S2 - 2020
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.
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:
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:
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).
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.
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
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:
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?
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:
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)).
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.
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).
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.:
10
School of Science and Technology