Professional Documents
Culture Documents
Lab Script 2 2023
Lab Script 2 2023
General instructions
LI Communication Systems (13812) & LH Communication Systems for Aerospace A (33289) are
practical modules. All of the assessments are via coursework, and the second assessment is based on
the second lab. In this lab you will apply what you have learnt in the lectures and you will
demonstrate concepts from these lectures in MATLAB. When working on this assessment, make sure
that you refer back to the lectures. You will also need to have done the MATLAB on ramp in advance
of the lab. This can be found at: https://uk.mathworks.com/learn/tutorials/matlab-
onramp.html?s_tid=tah_po_mlonramp
When a question says ‘write a routine in MATLAB’ it means that you should create a .m file, which
can be run by any user who opens the file in MATLAB and clicks ‘run’. An example of such a file is
fib.m, which has been loaded onto Canvas as an example. fib.m includes clear, concise comments.
Anything that can be changed by the user is clearly marked. You should work to the same standards.
Before the lab, make sure that you have read through the lab script, watched the three introductory
videos (available on the Canvas page, under the Modules -> Lab 1 tab. These are called lab-intro-
part-1, lab-intro-part-2 and lab-intro-part-3) and completed the MATLAB on ramp
(https://uk.mathworks.com/learn/tutorials/matlab-onramp.html?s_tid=tah_po_mlonramp). This will
ensure that you get off to a flying start during the lab session.
The videos mentioned here are the same as for the first lab so, if you remember these clearly, then
you do not need to watch these again.
Prioritise tasks which need to be done in MATLAB – these are the ones where you are most likely to
need some help. Leave writing up the various exercises until after the lab session.
Submission of work
You will submit a single word document on Canvas which contains your work for this assessment,
plus MATLAB (.m) files where these are requested. You are welcome to continue working on this
after the lab. You may spend as much time as you like on this, provided that your work is submitted
on Canvas by 11:00 on Tuesday 28th November 2023.
Format of files
Your word document must be in one of the following formats: .doc, .docx or .pdf. Other file formats
may not open or display correctly on university devices.
Your Matlab file must be a single .m file for each question. You can write this in any version of
Matlab that you like, but it will be tested in the online version of Matlab (matlab.mathworks.com),
so you should ensure that your code runs on this platform. When you submit code on Canvas, it
renames your files. Therefore you should not use one Matlab file to call another. You should not
declare functions – i.e. the following code calculates the average value of x. However this will not
work after the file has been uploaded to Canvas.
function ave = calculateAverage(x)
ave = sum(x(:))/numel(x);
end
Instead, you should write a code which can be executed if the user opens the script and presses
‘run’. An example of such a code is in on the Canvas page for this module under ‘Modules’ -> ‘Lab 1’ -
> ‘fib.m’
Please do ask for help. All questions are welcome. As a number of staff are involved in this lab, I have
produced a guide for staff, which details how much help should be provided. You are welcome to ask
any question, any time. There might be some questions which we cannot answer, as they are an
integral part of the assessment, but you are welcome to ask. The best ways to request help are:
• During the lab: Please ask any of the staff who are in the room.
• After the lab: By email: Email Alan Wood at a.wood.1@bham.ac.uk at any time. Any
questions sent in by the end of the day on Friday 24th November are guaranteed a reply
before the submission deadline. Due to the volume of enquiries, I cannot guarantee a
response to questions asked after this date, but I will do my best. I do not check emails
during the weekends.
• After the lab: In person: Please drop round to see Alan Wood in room 224 of the School of
Engineering building. The best days to find me are Monday, Wednesday and Thursday. You
do not need an appointment, but you can email me at a.wood.1@bham.ac.uk to arrange an
appointment if you prefer.
Question 1
Write a routine in MATLAB that calculates the FFT of a triangular pulse or a Gaussian pulse. Your
routine only needs to do one of these (not both). The FFT should be plotted over the negative to
positive range.
Engineers rarely write code from scratch. It is often more efficient to take and modify a code which
already exists. You may, if you wish, take the MATLAB code FT_flat_topped_pulse.m which was used
in the lectures and modify this. In this case marks will be awarded for how you modify the code. If
you prefer, you may write a MATLAB code from scratch. This question is not assessed, but you need
to complete it as question 2 builds from this. As question 1 is not assessed, you may ask for as
much help as you need with this question (during the lab). If you wish, you may also work with
other students on this question. Questions 2 and 3 need to be done independently.
Questions 2
A useful property of Fourier transforms is linearity, where the addition of two signals in the time
domain is equivalent to the addition of two signals in the frequency domain. In other words:
Write a routine in MATLAB which demonstrates this principle. The two functions chosen should be
chosen from the following list:
• Sine wave
• Cosine wave
• Flat-topped pulse
• Half-cosine pulse
• Gaussian pulse
You may use two functions of the same type (as long as they have different periods), or they may be
of different types. It may be that you find that you cannot demonstrate linearity. If this is genuinely
not possible, then the full range of marks are available if you can explain, clearly and in detail, why
this was not possible (i.e. explanations of ‘I didn’t know how to implement function X’ do not get the
full range of marks, explanations of ‘at point X, MATLAB fails to evaluate function Y because …’ could
get the full range of marks.
Question 3
Filters are covered in detail later in the course, and you will use these in the final assignment. In this
assignment, please use a moving median filter, for which the MATLAB command is movmedian.
It can be difficult to know where to start with a question such as question 3, so I have provided a
suitable starting point (shown below). This is not the only possible starting point, nor it is necessarily
the best starting point, but you are welcome to use this if you wish. As you can see, the structure is
similar to that used in the lectures for the FFT example. A key difference is that an array is set up,
and the first column of the array is used for the time vector. You could use subsequent columns of
the array for subsequent steps in your solution.
Submission of work
You should submit a single word document containing a short summary of what you did for each
question, together with any plots needed for your explanation. Don’t forget to include this
explanation – you cannot get the highest marks if you just submit code and plots.
For each question, you should also submit a single .m file containing your code, which can be run by
another user. This code should be something that the user can open, press run and it will
automatically run without any other input from the user. Your MATLAB code should produce all of
the plots which are included in the short summary, and should leave them up on the screen. When
marking your work, I will open your .m file, press run and see if this creates a result which is correct
and which matches the plots in your short summary. I will assume that your code has been written
to run in MATLAB version 2021b, unless you state otherwise.
Mark scheme
• Question 1: 0%
• Question 2: 50%
• Question 3: 50%
Each question has a number of strands, which indicate how well you have performed in each of a
number of categories (please see the following pages). Your overall mark for each question reflects
the overall standard that you have achieved and is not the weighted average of the strands. This
comment refers to questions 2 and 3 only, you do not need to submit anything for question 1.
The above strands are provided for information only. The mark awarded for each question is based on the overall standard of your work, and is NOT the weighted average
of these strands.