You are on page 1of 2

Final Exam of Computational Methods and Modeling for Engineering Applications (GENG-8030)

Instructor: Dr. Mohammad Sedigh Toulabi


12th of Dec. 2022
12:00 PM to 2:40 PM
Note: There are five questions to answer. Please report the complete program for each question and upload the
solutions sheet as a single .pdf in the designated place in Blackboard before 2:40 PM.
Question 1 (10 marks):
There are two drones flying in the air. The instantaneous speed of drone “A” can be formulized as follows.
2t + 1
V (t ) A =| esin(2t ) | . m/s
60
The instantaneous speed of drone “B” can be formulized as follows.
1

V (t ) B =| cos(et ) + 1| .41+t m/s


2

Calculate the average speed and of drones “A” and “B” using “mean” command of MATLAB for
the first 100 s with the time step of 1 s and display the results.
Build the codes and plot the following graphs for (a) and (b) in a same figure window using subplot command.
a) The instantaneous speeds versus time (0 – 100 s) for both drones “A” (left) and “B” (right) in a same row with
the time step of 1 s. Label x and y axes as ‘Time (seconds)’ and ‘Speed (m/s)’ and add legends for each graph,
e.g., Drone A and Drone B. The plot line of drone “A” should be dotted red and the plot line of drone “B”
should be blue dash-dotted.
b) The initial locations at t=0 s for both drones are shown in Fig. 1. Drone A is moving toward west with the
average speed of , while drone B is move toward east with the average speed of as shown by
the arrows. Plot the relative distance between the drones versus time for (2 minutes) 120 s in time step of 1 s
in the second row of the subplot window. Use ‘Time (mins)’ and ‘Distance (meters)’ for x and y axes. Use a
legend “Distance” for the plot and the plot line should be a green solid line.
Note: Two sub-graphs of (a) are put in the first row and one wide graph of (b) is put in the second row of the
figure window.

Fig. 1. Initial location of drones “A” and “B”.

Question 2 (8 marks):
Use MATLAB to create Matrix A as follows,

Write appropriate codes and array addressing commands and display the results to:

1
a) Find the maximum, minimum and average value of the elements in an array once each element of that array is
the corresponding product of the 1st, 2nd, 3rd and 4th rows of Matrix A and define the new array as Matrix B.
b) Extract all the elements located in 299th through 301st columns of Matrix A and save it as Matrix C.
c) Extract all the elements in the 2nd to 4th rows and 119th through 122nd columns of Matrix A and define it as
Matrix D.
d) Calculate E = C+ DT and display the matrix.
Note: T is the operator to transpose the matrix.
Question 3 (8 marks):
A car shown in Fig. 2 uses a parachute to slow down during braking. Its acceleration (a) as the function of time
(t) and speed (v) is given by:
a = −0.0035v 2 − 3 m/s2
Assume that the car has the velocity of 300 km/h before the parachute and braking system are activated and it
starts decelerating at t=0s.
Write a code to show the velocity (v) versus time (t) plot and investigate at what time (t) the car will fully stop.
Add appropriate labels for axes, i.e., ‘Time (s)’ for the horizontal axis and ‘Velocity (m/s)’ for the vertical axis.

Fig. 2. Car and its velocity and displacement directions.


Question 4 (8 marks):
The reciprocal Fibonacci constant A is defined by the infinite summation as follows.

1
A=
n =1 Fn

where, Fn are the Fibonacci numbers F1=1, F2=1, F3=2, F4=3, F5=5, F6=8, F7=13, ... . Each element in this
sequence of numbers is the summation of the previous two numbers. Start by setting the first two elements equal
to 1, then Fn = Fn-1 + Fn-2 .
Write a MATLAB code that calculates A for a given n. Execute the program for n = 2, 10, and 100 and show the
outputs.
Question 5 (8 marks):
d2y
Build a Simulink block diagram for the differential equation given as follows and display y and 2 signals in a
dt
same scope. The scope should only have one input. Use appropriate legends in scope. Plot the same signals using
“to workspace” block and put the signals in a two row one column subplot arrangement. Label vertical and
horizontal axes of each plot appropriately. The initial conditions are y(0)=0 and y’(0)=1 for 0 ≤ t ≤10 s.
d2y dy
2
+ 3 + 4 y = −2 cos(2t ) + sin(t )
dt dt
End.

You might also like