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

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

Instructor: Dr. Mohammad Sedigh Toulabi


13th of Dec. 2021
3:30 PM to 6:10 PM

Question 1 (8 marks):
Create a MATLAB function to solve the following set of linear equations to determine the
unknown currents (i1, i2, i3). Where the inputs of the function are known resistances, i.e., R1, R2,
R3 and R4.
(𝑅1 + 𝑅2 )𝑖1 = 24
𝑅3 𝑖1 − (𝑅1 + 𝑅2 )𝑖2 = 𝑅3 𝑅4 𝑖3
𝑅1 𝑅3 𝑖2 = 𝑅4 𝑅3 𝑖3
a) Use the built function to calculate the currents (i1, i2, i3) for the given resistances of 𝑅1 =
1Ω , 𝑅2 = 1Ω, 𝑅3 = 2Ω, 𝑎𝑛𝑑 𝑅4 = 100Ω.
b) Use the same function to solve the below new set of linear equations for the given
resistances of 𝑅1 = 7.0711Ω , 𝑅2 = 6.3246Ω 𝑎𝑛𝑑 𝑅3 = 7.7460Ω.
𝑅12 𝑖1 − 𝑅22 𝑖2 = 10
𝑅32 𝑖2 − 𝑅22 𝑖1 = −20
Question 2 (8 marks):
The stock price values of a company have been reported for the last 12 months in the table below.

Month 1 2 3 4 5 6 7 8 9 10 11 12
Stock price 210 214 212 216 217 222 223 221 223 219 221 220
a) Fit a third-degree polynomial to the stock price records. Display the coefficients.
b) Estimate the expected stock price for the next two months (Months 13 and 14) and display
them in the command window.
c) Plot the curve fitting graph and data points for 14 months in a same figure window. Data
points should be displayed by blue upward triangle markers and curve fitting graph should
be just a solid line. Label x and y axes as “Months” and ‘Stock price”, respectively.
Note: all codes should be reported.
Question 3 (8 marks):
The forced oscillation in a harmonic oscillator, due to the force of incident beam of radiation, can
be formulated as bellow:
𝑚𝑥̈ (𝑡) = −𝑚𝜔02 𝑥(𝑡) + 𝑚𝜏𝑥⃛(𝑡) − 𝑞𝐸0 𝑒 𝑖𝜔𝑡 ,
where x is the position of oscillator as a function of time t, m is the mass of harmonic oscillator,
𝜔0 is the frequency of harmonic oscillator, 𝐸0 is the external electromagnetic (EM) driving force,
and 𝜔 is the frequency of incoming EM wave.

1
Suppose that we have 𝜏 = 30 , 𝜔0 = 2 𝐻𝑧, 𝜔 = 10 𝐻𝑧, 𝐸0 = 40 𝑉𝑚−1 , 𝑚 = 0.05 𝑘𝑔, 𝑞 = 0.1 𝐶.
a) Using the ode45 function solve the given third-order differential equation, in the range of
0 ≤ 𝑡 ≤ 5, with the initial conditions of 𝑥 (0) = 0.1, 𝑥̇ (0) = 0, 𝑥̈ (0) = 0.
b) Plot the position (𝑥(𝑡)), velocity (𝑥̇ (𝑡)), and acceleration (𝑥̈ (𝑡)) of the oscillator in a 2*2
subplot arrangement, with proper horizontal and vertical axis labels and titles for plots.
Question 4 (8 marks):
A 22-year-old 75 kg human response to the corona vaccination is described as the transfer
function, H(s), that relates the output immune response with respect to the input vaccination. In
H(s), G is age, D is 1 for first dose vaccination and 2 for second dose vaccination and M is weight
(kg))
30𝑀
𝐻 (𝑠 ) =
(𝑠 + 𝐺)(𝑠 2 + 4𝐷𝑠 + 100)

a) Build the Simulink model and plot the response of the transfer function (until t=10s) to the
first dose and second dose of vaccination along with the unit step input occurred at t=3.5 s
in the same scope (three signals in a same scope).
b) Report the steady state errors between the input and response signals.
c) Find the maximum overshoots and report them for each dose of vaccination.
Question 5 (8 marks):
The relation between the output (Y(s)) and input (U(s)) in a dynamic system is determined by the
following equation:

𝑌(𝑠) 𝑠 2 + 2.5𝑠 + 0.75


=
𝑈(𝑠) 𝑠 3 + 4𝑠 2 + 8𝑠 + 1
a) Using Simulink, plot the output (Y) and input (U) on the same scope (the scope has only
one port) when a step input with step time = 1s and amplitude = 5 is applied. 0 ≤ 𝑡 ≤ 10,
Show the Simulink model used to determine the output (Y).
b) It is required to use a PID controller and choose the parameters (p, I, and D) so that the
output signal follows the input signal of (a) with the steady state error less than 0.01 within
3 seconds after the input is applied. Show the Simulink model, the controlled output
response and input signal in a same scope. 0 ≤ 𝑡 ≤ 10.
Hint: p is between 80 to 120, I is between 40 to 60 and D is between 0 to 2.

You might also like