### Recent Question/Assignment

Assessment: Assignment 3
Due: 12 October 2020
Marks: 300
Value: 30%
1 Question 1 (100 marks)
1.1 Introduction
In some data analysis, one only considers the function value at each data point. Values of temperature of an equipment have been measured in Celsius and recorded in File A3Q1_input.txt . Given a set of function values, your task is to mathematically/satistically characterise the data set.
To obtain consistent results from your random number generation, you should initialise the seed to a fixed value using rng(seed) . For your assignment, the value (which is not to be shared with anyone else) is:
seed = 2.4982
1.2 Requirements
For this assessment item, you must perform hand calculations on the data in File A3Q1_input.txt
1. Find the sample mean and standard deviation for the first 10 data values. Report the answer in engineering convention form.
2. For the first 20 data values, use an appropriate representation of the data to calculate the absolute frequency, relative frequency and scaled frequency. Report the answer in engineering convention form.
You must also produce MATLAB code, stored as m-file(s), which:
3. Load the data file into MATLAB and repeat the hand calculations. Verify your answer using the reported results from Requirements 1 & 2.
4. Plot the scaled frequency using all the sample data to visualise what kind of distribution may be appropriate. Note that all of the calculation from this requirement to the end of this question are to use the full set of data.
5. Determine which theoretical distribution best describes the data set. Part of this proof may be demonstrated by completing Requirements 6-7.
6. Find the parameters of the theoretical distribution of the data set, along with an assessment of the accuracy of these values. Reports the obtained results to Command Window.
7. Graphically compare the sample probability density function (pdf) (i.e. the sample scaled frequency) and theoretical pdf for the data set.
8. Find the probability for the temperature less than or equal to the sample mean to occur.
9. Use the same theoretical distribution found in Requirement 5 to generate a new data set with the following changes: the size of the data set is two times larger, its mean is equal to µ + 5 and its standard deviation equal to 0.5 s, where µ and s are the mean and standard deviation of the data set in the file. Store them in an ascii file with values rounded to 3 significant figures.
You must submit a short video (10-30 seconds) where you discuss:
• the part of the code of which you are most proud; and
• the part of the code which you found most difficult to get working correctly.
Your video must show the relevant part(s) of the code while you are discussing them. Your video will be marked based on whether one is submitted or not: full marks for this item if a video is submitted; zero marks if a video is not submitted.
1.3 Assessment Criteria
Your submission will be assessed using the following scheme. Note that you are marked based on how well you perform for each category, so the correct answer determined in a basic way will receive half marks and the correct answer determined using an excellent method/code will receive full marks.
Quality of Requirements 1 & 2 20 marks
Quality of Requirement 3 10 marks
Quality of Requirement 4 10 marks
Quality of Requirement 5 10 marks
Quality of Requirement 6 10 marks
Quality of Requirement 7 15 marks
Quality of Requirement 8 5 marks
Quality of Requirement 9 5 marks
Submission of video 5 marks
2 Question 2 (100 marks)
2.1 Introduction
Consider instantaneous velocities stored in File A1_input.txt (Assignment 1). Their variation with respect to time can be mathematically described as
vx(t) = -2sin(t) - 2sin(2t) m/s, (1) vy(t) = 2cos(t) + 2cos(2t) m/s, (2)
and these functions are utilised here to generate new velocity data sets. From (1) and (2), one can derive analytic expressions for computing the acceleration
ax(t) = -2cos(t) - 4cos(2t) m/s2, (3)
ay(t) = -2sin(t) - 4sin(2t) m/s2, (4)
which are used here to analyse the obtained numerical results. Your tasks are to find the rate of change of velocity with respect to time (i.e. acceleration) using three different finitedifference schemes and to estimate how large the velocity data set should be for a given accuracy of acceleration.
2.2 Requirements
For this assessment item, you must perform hand calculations:
1. Find the rates of change of the x and y velocity components at t = tk, where k is obtained by using MATLAB function round to round the following value to the nearest integer
[1 + 2.7435 × 10]
(this value is not to be shared with anyone else), by means of Forward, Backward and Central Differences. Report the answer in engineering conventional form.
You must also produce MATLAB code, stored as m-file(s), which:
2. Load the data file into MATLAB and find the rates of change of the x and y velocity components at t = tk using the three finite-difference schemes. Verify your answer using the reported results from Requirement 1.
3. Find the rate of change of the x velocity component at interior values of time (i.e. at ti, i = (2,3,··· ,N - 1), N the number of numeric data rows) using the three finitedifference schemes. Report the most accurate scheme (demonstrating it numerically and graphically).
4. Find the rate of change of the y velocity component at interior values of time (i.e. at ti, i = (2,3,··· ,N - 1), N the number of numeric data rows) using the three finitedifference schemes. Report the most accurate scheme (demonstrating it numerically and graphically).
5. Find a velocity data set generated using constant time step, on which, by means of Forward Differences, the maximum absolute error of the interior x acceleration solution is about 0.1. Repeat this task for smaller error values: 0.05 and 0.01.
6. Verify Requirement 5 using the exact solution (3).
7. Compute the x acceleration components for the three data sets in Requirement 5 using Central Differences. Report the corresponding maximum absolute errors.
8. Estimate the rate of convergence with respect to time step (?t) for Forward and Central Differences based on the data obtained in Requirement 5 and 7, respectively. Report the best scheme and explain why (numerically and theoretically).
2.3 Requirements
You must submit a short video (10-30 seconds) where you discuss:
• the part of the code of which you are most proud; and
• the part of the code which you found most difficult to get working correctly.
Your video must show the relevant part(s) of the code while you are discussing them. Your video will be marked based on whether one is submitted or not: full marks for this item if a video is submitted; zero marks if a video is not submitted.
2.4 Assessment Criteria
Your submission will be assessed using the following scheme. Note that you are marked based on how well you perform for each category, so the correct answer determined in a basic way will receive half marks and the correct answer determined using an excellent method/code will receive full marks.
Quality of Requirements 1 & 2 20 marks
Quality of Requirements 3 & 4 20 marks
Quality of Requirements 5 & 6 25 marks
Quality of Requirements 7 & 8 20 marks
Submission of video 5 marks
3 Question 3 (100 marks)
3.1 Introduction
Consider a velocity data set that is given in Assignment 1 (File A1_input.txt ). For this motion, the initial condition is (x = 4 m,y = 0 m) (the position of the object at the initial time t = t1 (t1 = 0)). To obtain the position of the object at other time levels ti, where i = (2,3,··· ,N) (N is the number of numeric data rows), one needs to integrate velocity with respect to time over intervals. In Assignment 1, the velocity components on intervals are simply represented by constant functions, which is referred to as a constant scheme. In this question, linear functions are used to represent the velocity components on intervals (a linear scheme or Trapezoidal numerical integration). The variations of velocities in the data file can be mathematically described as
vx(t) = -2sin(t) - 2sin(2t) m/s, (5)
vy(t) = 2cos(t) + 2cos(2t) m/s, (6)
which are utilised here to generate new velocity data sets. From (5) and (6), one can derive analytic expressions for computing the position of the object
x(t) = 2cos(t) + 2cos2(t) m, (7)
y(t) = 2sin(t) + sin(2t) m, (8)
which have satisfied the given initial condition. Functions (7) and (8) are used here for analysis of the obtained numerical results.
Your tasks are to find the positions of the object from the data file using the linear scheme and to estimate the largest time step needed for a given accuracy of the position.
3.2 Requirements
For this assessment item, you must perform hand calculations:
1. Find the position of the object at t = 0.12 s using the linear scheme and report the answer in engineering conventional form. Compare the obtained results with those from Assignment 1.
You must also produce MATLAB code, stored as m-file(s), which:
2. Load the data file into MATLAB and find the position of the object at t = 0.12 s using the linear scheme and taking a for-loop. Verify your answer using the reported results from Requirement 1.
3. Find the positions at different time levels (i.e. at ti, i = (2,3,··· ,N), where N the number of numeric data rows) using the linear scheme. Display the variations of the x and y positions with respect to time on the same graph. Verify with Requirement 2.
4. Compare the obtained results with those from Assignment 1 and display your comments in the command window.
5. Find a time step at which the absolute error of the x position at t = tr is about 0.01
tr = [1 + 9.2788 ÷ 10] s.
Repeat this task for smaller error values: 0.001 and 0.0001. Note that from this requirement to the end of this question, velocity data sets are acquired from (5) and
(6) (not taken from the file).
6. Verify Requirement 5 using the exact solution (7).
7. Compute the x position at t = tr using the three time steps in Requirement 5 by the constant scheme.
8. Estimate the rate of convergence with respect to time step (?t) of the linear and constant schemes from the data obtained in Requirement 5 and 7, respectively. Report the best scheme and explain why.
3.3 Requirements
You must submit a short video (10-30 seconds) where you discuss:
• the part of the code of which you are most proud; and
• the part of the code which you found most difficult to get working correctly.
Your video must show the relevant part(s) of the code while you are discussing them. Your video will be marked based on whether one is submitted or not: full marks for this item if a video is submitted; zero marks if a video is not submitted.
3.4 Assessment Criteria
Your submission will be assessed using the following scheme. Note that you are marked based on how well you perform for each category, so the correct answer determined in a basic way will receive half marks and the correct answer determined using an excellent method/code will receive full marks.
Quality of Requirements 1 & 2 20 marks
Quality of Requirements 3 & 4 20 marks
Quality of Requirements 5 & 6 25 marks
Quality of Requirements 7 & 8 20 marks
Submission of video 5 marks

Submission
Submit your code, along with input/ouput files, by the due date to the StudyDesk. Submit your hand calculations as a pdf file, and your video as a standard video file. The maximum submission size is 20 MB. If your videos are too big, convert them to a lower resolution using Handbrake (https://handbrake.fr/) or something similar. Note that
• You do not need to rename your files when uploading: the system automatically segregates different students’ submissions.
• If you can see that the files have uploaded, then you have successfully submitted your assignment. There is no need to click a “send for marking” button, but you will have to click a button confirming that the submission is your own work.
• You MUST upload all of your code and your pdf file along with input/output files in a *.zip file. You do not need to install any special software to be able to do this. In Windows: right-mouse-click on the file(s)/folder(s) that you want to include, then choose “Send to” ? “Compressed (zipped) folder”. The following are the only file types that can be submitted:
– *.zip
– *.pdf
– *.doc
– *.docx
– standard video formats
The system will block any attempt by you to upload a file which doesn’t match any of those file extensions.
• After the submission deadline, if you forgot to submit a file, do not upload it after the due date: the submission time is based on when the last file was uploaded. You should email the examiner in this circumstance (with any file attached).