CS1MA20 Spring Term Assessment - 2023 - 4

You might also like

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

Department of Mathematics and Statistics

Summative Coursework Set Front Page

Module Title: Mathematics and Computation


Module Code: CS1MA20
Lecturer responsible: Professor P Glaister
Type of Assignment: Individual
Weighting of the Assignment: 35%
Page limit/Word count: n/a
Expected hours spent for this assignment: 10 including preparatory lab sessions

Items to be submitted: Report in PDF format


Work to be submitted on-line via
Blackboard Learn by: March 7 2024 at 12 noon
Work will be marked and marks
will be made available by: March 28 2024 at 12 noon

NOTES
By submitting this work, you are certifying that it is all your own and has not been taken from any
other person's work except where explicitly the works of others have been acknowledged, quoted,
and referenced. You understand that failing to do so will be considered a case of plagiarism.
Plagiarism is a form of academic misconduct and will be penalised accordingly. The University’s
Statement of Academic Misconduct is available on the University web pages.
If your work is submitted after the deadline, 10% of the maximum possible mark will be deducted
for each working day (or part of) it is late. A mark of zero will be awarded if your work is submitted
more than 5 working days late. You are strongly recommended to hand work in by the deadline as
a late submission on one piece of work can impact on other work.
If you believe that you have a valid reason for failing to meet a deadline then you should complete
an Extenuating Circumstances form and submit it to the Student Support Centre before the
deadline, or as soon as is practicable afterwards, explaining why.
1. Assessment classifications
You are asked to submit a document with your answers to a series of mathematics and computation
questions, associated with each question there is a mark. The mark you are awarded overall will be
the sum of the marks awarded for all questions.

2. Assignment description
You are asked to determine the answers to a series of mathematics and computation questions
based on the material covered in the first 7 weeks of the Spring term. Most questions require you
to use MATLAB. Your answers should be put into a document which you will submit as a PDF
document.
Note everyone will do the same form of questions, but the numbers used in them will be
determined using your student number, and I CAN CHECK YOU ARE USING THE CORRECT
QUESTIONS.

CS1MA20 1 PG 11/12/2023
You need to download a set of MATLAB task files from Blackboard which are to found alongside
this description, and run them, copying the command line output displaying your questions.
For each question, first put in the report the question the individualised task you have been set,
and then your answer.
Some questions require you to do some mathematics. You can choose to write these by hand, in
which case you should check they are legible and then scan the work and paste it into the report.
Alternatively, you can type them directly into the report.
It is explained on Blackboard how you can get a free copy of MATLAB.
You are urged to do the questions relating to the topics as they are covered in the module, and so
build up the document that you submit.
You can do this creating your report in Word, say. When you are ready to submit your report,
please generate a PDF document for submission to Blackboard.

Additional information
The tutorial and timetabled PC sessions provide you with practise for the type of questions in the
assignment. You may be able to use the PC sessions to do some of this assignment.

3. Assignment submission requirements


1. YOU MUST USE THIS TEMPLATE TO SUBMIT YOUR ANSWERS in PDF format as a single file, with
filename:
CS1MA20_Spring_23_4_TEMPLATE_for_ANSWERS_StudentID
where ‘StudentID’ is YOUR 8 digit STUDENT ID (starting with either 30, 31, or 32)
2. You must submit your report via the GRADESCOPE SUBMISSION POINT, and you MUST tag
each page as one of either:
Question 1 or Question 2 or Question 3
depending on which of these Questions has been answered on that page.
You should submit only your report in PDF format.
When you submit your report, you MUST tag each page as one of either:
Question 1 or Question 2 or Question 3
depending on which of these Questions has been answered on that page.
Check that you get confirmation that the report has been submitted.
The report will be marked and returned to you with feedback where appropriate.

4. Marking scheme
Each question provided has marks allocated. You will get full marks if the work shown, and the
answers are correct. If you use MATLAB, you should include in your report the commands you used,
and the output from MATLAB, including graphical output, where appropriate. Marks will be lost if
the answer is incorrect, or the working or commands or codes are missing.
This assignment contributes to 35% of the marks for the module.

CS1MA20 2 PG 11/12/2023
Assignment Tasks
Question 1: Newton-Raphson method for finding the largest root of a
given equation (22 marks)
(i) Please include both the questions and then your answers in your report.
(ii) You need to run BBTask1.p to start with getting a given function based on your student
number.
(iii) To do this you will need to download the file BBTask1.p from Blackboard to the folder in
the search path that MATLAB will access when you enter a filename.
(iv) Please copy from the MATLAB command line after running, e.g.
>>BBTask1
My student ID is 12345678
(Use the first 8 digits of YOUR Student ID – this will start with either 30, 31, or 32)

My function: f(x) = 100 x^3+ (-303)x^2+ (-1609)x+(-1206)


Note: this means: f ( x) = 100 x3 − 303x 2 − 1609 x − 1206

(a) Give the MATLAB commands using the built-in function fplot to plot f ( x) against x in the
interval −3  x  8 , including labels for the horizontal and vertical axes, and include the
graph in your answer.
6 marks
df
(b) Find the derivative f ( x) = by hand without using MATLAB.
dx
3 marks
(c) Give the MATLAB commands using the built-in function diff to find the derivative
df
f ( x) = , and give the output.
dx
3 marks
df
(d) Using the built-in function fplot, plot f ( x) =
on a graph in the interval for x ranging
dx
from −3 to 8 , and include the graph in your answer.
6 marks
(e) BBTask2.p is a MATLAB program which performs Newton-Raphson iterations:
f ( xn )
xn +1 = xn −
f ( xn )
for solving f ( x) = 0 from an initial starting value x0 .
Download the file BBTask2.p from Blackboard to the folder in the search path that
MATLAB will access when you enter a filename.
CS1MA20 3 PG 11/12/2023
Experiment using the BBTask2.p using the MATLAB command line:
>>BBTask2
with different initial starting values to find the LARGEST solution of f ( x) = 0 to 2 decimal
place accuracy. You may find the graph in question 1 above helpful to choose an initial
starting value.
When you have found this solution, run the program BBTask2 again to show between
iterations which demonstrate that 2 decimal place accuracy has been achieved, and copy
this output into your report.
4 marks

CS1MA20 4 PG 11/12/2023
Question 2: Integration and numerical integration for a given function
(16 marks)
(i) Please include both the questions and then your answers in your report.
(ii) You need to run BBTask3.p to start with getting a given function based on your student
number.
(iii) To do this you will need to download the file BBTask3.p from Blackboard to the folder in
the search path that MATLAB will access when you enter a filename.
(iv) Please copy from the MATLAB command line after running, e.g.
>>BBTask3
My student ID is 12345678
(Use the first 8 digits of YOUR Student ID – this will start with either 30, 31, or 32)

My function: g(x)= (1)x^2+ (-7)x+ (15)


Note: this means: g ( x) = x 2 − 7 x + 15

6
(a) Find the definite integral 0
g ( x) dx by hand without using MATLAB, giving your answer
to the nearest whole number.
5 marks
(b) Give the MATLAB commands using the built-in function int to find the definite integral
6
0
g ( x) dx , and give the output.

4 marks
(c) With three integrating points [0 3 6] , give the MATLAB commands using the built-in
6
function trapz to determine a numerical approximation for 0
g ( x) dx , and give the
output.
4 marks
6
(d) Use the MATLAB built-in function integral to find numerical solution of 0
g ( x) dx .

3 marks

CS1MA20 5 PG 11/12/2023
Question 3: Using the MATLAB function ode45 to simulate a robot
motion based on a second order differential equation (22 marks)
(i) Please include both the questions and then your answers in your report.
(ii) You need to run BBTask4.p to start with getting a given function based on your student
number.
(iii) To do this you will need to download the file BBTask4.p from Blackboard to the folder in
the search path that MATLAB will access when you enter a filename.
(iv) Please copy from the MATLAB command line after running, e.g.
>>BBTask4
My student ID is 12345678
(Use the first 8 digits of YOUR Student ID – this will start with either 30, 31, or 32)

My robotics system is : dy^2/dt^2 + 1.9878 dy /dt + y = 20


d2y dy
Note: this means 2
+ 1 9878 + y = 20
dt dt

A robotic arm tracks a command signal of moving its position to y = 20 from an initial position
y(0) . The motion follows a dynamical system model, created from your student number.
(a) Represent this robotics system in a vector differential equation form (state space model).
5 marks
(b) Give the MATLAB commands using the built-in function ode45, with time span [0 20], and
initial conditions y(0) = 0 , y(0) = 0 , to determine a numerical solution of your robotics
system.
6 marks
(c) Give the MATLAB commands and using the in-build command subplot, to plot the numerical
dy
solution for the position y and the velocity obtained from part (b) as two separate
dt
subplots on the same Figure, with the graph of the position above the graph of the velocity.
Include labels for the horizontal and vertical axes, and a title for each subplot.
Include the Figure in your answer.

11 marks

END OF ASSESSMENT
CS1MA20 6 PG 11/12/2023

You might also like