Finalexam 13122021
Finalexam 13122021
Finalexam 13122021
Question 1 (8 marks):
To put an aggressive driving detection system using deep learning-based time series
classification’s results into perspective, a table of F1 score, highlighted below, compares the
model’s FCN-LSTM architecture performance with those of the Random Forest, Adaboost,
ResNet and LSTM models for different time window sizes.
Write MATLAB scripts and show the outputs to generate the exact replication of the following
plots (two figures) using the given table above.
Figure 1. Frits script to use plot. Figure 2. Second script to use subplot.
Question 2 (7 marks):
A table is given below. It is required to
a) Use MATLAB to create a 5*5 Matrix A including Dar, Fre, Pas, Rus and Urd values only.
b) Create a same size Matrix B having each column of Matrix A in ascending order.
c) Create Matrix C= 2A+B.
d) Return a row vector containing the largest elements in each column of Matrix C.
e) Create an identity Matrix D with the same size of Matrix C.
1
f) Extract all elements in 2nd through 4th rows and 1st through 3rd columns of Matrix C to
create a new Matrix E.
g) Create a Matrix F of ones with the same size of the Matrix E.
Question 3 (7 marks):
Write three anonymous functions in command window of MATLAB to implement the following
function descriptions.
𝑓(𝑥 ) = 3𝑥 2 − 2𝑥 + 5 𝑎𝑛𝑑 𝑔(𝑥 ) = √1 − cos(𝑥 2 ) 𝑎𝑛𝑑 ℎ(𝑥, 𝑦) = 𝑥 2 𝑦 − 𝑓𝑜𝑔(𝑥 ) − 0.5𝑦 3
a) What is h(1.3,-12)?
b) Plot ℎ(𝑥, 𝑦) = 0 for the x and y ranges of -6 to 6.
Question 4 (10 marks):
The Taylor series for estimation of 𝑓 (𝑥 ) = tan−1 (𝑥) can be formulated as below:
∞
−1
𝑥 (2𝑛+1) 𝑥3 𝑥5
tan 𝑥 = ∑ (−1)𝑛 =𝑥− + +⋯
2𝑛 + 1 3 5
𝑛=0
a) Write a while loop code in MATLAB to iteratively estimate tan−1 (𝑥 ) for x=0.93 using the
Taylor series, until the difference of the estimated and real values become less than or equal
to 0.001.
b) How many iterations does it take to satisfy (a) and what is the estimated value of Taylor
series after those iterations?
Question 5 (8 marks):
Create a Simulink model to plot and show the solutions (x(t) and 𝑥̇ (𝑡)) in a same scope for the
following differential equation for 0 ≤ 𝑡 ≤ 10.
5𝑥̈ (𝑡) − 𝑥̇ (𝑡) + 𝑥(𝑡) = 𝑠𝑖𝑛(𝑡) , 𝑥̇ (𝑡) = 2, 𝑥 (0) = 3
Use “To Workspace” block to generate the plots for x(t) and 𝑥̇ (𝑡) in a same figure window, label
the curves with appropriate legends and define appropriate horizontal and vertical axes labels.