Evaluate on both Ordinary Least Squares and Gradient Descent approaches in regression modelling.

Phase 1: Computational and Mathematical Analysis
These questions are designed to help you applying your learning from the nodes to the project, and formed part of the module assessments. You are required to submit both your handwritten and MATLAB computed solutions in your individual report.

Question 1A: Hand-written
If vector 𝑝̅ = πš€Μ‚ + 3πš₯Μ‚ βˆ’ 2π‘˜ΰ·  , π‘žΰ΄€ = 3πš€Μ‚ + 2πš₯Μ‚ + π‘˜ΰ·  and π‘ŸΜ… = 2πš₯Μ‚ + 3π‘˜ΰ· 
Determine the following:
i) Calculate 𝑝̅ βˆ’ π‘ŸΜ…
ii) Find the Unit Vector of π‘žΰ΄€
iii) Find the angle between the vectors π‘žΰ΄€ and π‘ŸΜ…
iv) Find a vector perpendicular to vectors 𝑝̅ and π‘žΰ΄€
If 𝐴 = ቂ3 2
4 1ቃ , 𝐡 = ቂ5 βˆ’1 2
1 10 2ቃ , 𝐢 = ΰ΅₯
2 4
1 βˆ’1
3 βˆ’2
ΰ΅© and 𝐷 = ΰ΅₯
1 2 1
βˆ’1 0 4
3 βˆ’1 2
ΰ΅©
v) Calculate BT – 2C + DC
vi) Calculate the determinant of AAT
vii) Find product of AA-1
viii) Find the inverse of BC

Question 1B : MATLAB Computation
Compute your calculation in Question 1A (i)-(viii) by writing a MATLAB script called Question1B.m.

Question 2A: Hand-written
Let the projectile trajectories of a cannon ball using equations for ideal projectile motion:
𝑦(𝑑) = 𝑦଴ βˆ’ ଡ
ΰ¬Ά 𝑔𝑑ଢ + ࡫𝑣଴𝑠𝑖𝑛(πœƒΰ¬΄)࡯𝑑 Eqn. 1
π‘₯(𝑑) = π‘₯଴ + ΰ΅«π‘£ΰ¬΄π‘π‘œπ‘ (πœƒΰ¬΄)࡯𝑑 Eqn. 2
where 𝑦 is the vertical distance and π‘₯ is the horizontal distance travelled by the projectile in metres, gravitational acceleration 𝑔 = 9.8 ms-2 and 𝑑 is time in seconds. Let us also assume the initial ball velocity 𝑣଴ = 35 ms-1, the projectile’s launching angle πœƒΰ¬΄= 5Ο€/12 radian, initial vertical (height) and horizontal positions are 𝑦଴ = 100m and π‘₯଴ = 0 respectively.

i) Solve for π‘₯ and 𝑦 , with 𝑑 representing the first 10 seconds. Sketch 𝑦 vs. 𝑑 and π‘₯ vs. 𝑑 in two separate graphs, and give appropriate titles to the graphs and label the axes.

ii) Find the exact time when the ball hits the ground and at what horizontal distance.

iii) To better visualise the projectile trajectory, sketch a new graph consisting both altitude on the 𝑦-axis and horizontal distance on the π‘₯-axis.

iv) Use the following adjusted angles to create two more trajectory plots on top of existing 𝑦 vs. π‘₯ sketched in (iii) and determine which launching angle results in a greater range.
πœƒΰ¬΄
ଡ = ቀହగ
ଡଢ βˆ’ 0.255ቁ radian Eqn. 3
πœƒΰ¬΄
ΰ¬Ά = ቀହగ
ଡଢ βˆ’ 0.425ቁ radian Eqn. 4
v) Modify and re-write the equations (e.g. Eqn. 1 and Eqn. 2) so that the launching angles will be insert directly as degree rather than radian.

Question 2B : MATLAB Computation
Compute your calculation in Question 2A (i)-(v) by writing a MATLAB script called Question2B.m. In addition, compute the following as well:

vi) Adjust the launching angle to produce the greatest range (i.e. maximum horizontal distance) but within 0Β° ≀ πœƒΰ¬΄ ≀ 90Β° in incremental of 0.1. Evaluate your results.

vii) Adding the optimal trajectory on top of existing 𝑦 vs. π‘₯ sketched in (iii).

Question 3A: Hand-written
In the circuit shown in Figure 1, the DC voltage sources are given as 120V, 60V and 10V, whereas the DC current source is 36A. The value of the resistors are given as R1= 20Ω, R2= 5Ω, R3= 4Ω, R4= 6Ω, R5=
8Ω and R6= 4Ω.
Figure 1
i) Determine the total power dissipation of all the resistors e.g. RTotal?

ii) Identify the resistor with the highest power dissipation value?

iii) Figure 2 is the exact circuit illustrated in Figure 2. However, we are now required to determine the current through R1= 20Ω by using Source Transformation method ONLYand finishing off with 2nd Kirchhoff’s Law.
Figure 2
IR1 = ?

Directions of currents which you choose should indicate by arrows. Both magnitude and the sign of the currents should be provided by the answers. You should also indicate the any loops you created for the 2nd Kirchhoff’s Law or Mesh Analysis. You need to show your working, circuits simplification, assumptions you made and explain your reasoning.

Question 3B : MATLAB Computation
Compute your calculation in Question 3A (i)-(ii) ONLY by writing a MATLAB script called Question3B.m.
Formulate your solution in matrix format of Ax=b and you are also required to display the following text β€˜Resistor with the highest power dissipation value is ….. ’ once you identify the hight value.

Question 4A: Hand-written
Figure 3
i) Draw the free body diagram (FBD) of the beam ABC as illustrate in Figure 3.

ii) Calculate the reactions at the wall as a result of the loadings. (Assuming counter-clockwise as positive value).

iii) Sketch the shear force (SF) and bending moment (BM) diagram for the beam, and showing the values.

iv) If the beam (in Figure 1) has a cross section as show in Figure 4, what are the maximum tensile and compressive stress due to the bending. [in SI unit]

v) Are there differences between the maximum tensile and compressive stress? Why?
Figure 4
(Hint! Please re-visit the Statics A and Solid Mechanics 1 node to re-cap on the Engineering Science & Mathematics principles in solving the problem above. Also, remember to re-cap on Dimensional Analysis for unit (e.g. SI) conversion.
100 mm
75 mm
75 mm
25 mm
x
4 kN 6 kN
6 m 2 m
AB
C

Question 4B : MATLAB Computation
Compute your calculation in Question 4A (ii)-(iv) by writing a MATLAB script called Question4B.m.
Label the axes meaningfully and give the figure a title.

Question 5A: MATLAB Computation
Estimating the costs of drilling oil wells is an important consideration for the oil industry. Table 1 illustrates the total costs and the depths of 16 offshore oil wells located in country Z.

In general, the drilling cost of drilling an oil well depends on the depth at which you are drilling e.g. drilling becomes more expensive, per meter, as you dig deeper.
Well Platform No. Depth (m) Cost ($ million)
1 1524 2.59
2 1585 3.33
3 1829 3.18
4 1993 3.19
5 2167 4.78
6 2303 5.91
7 2440 5.77
8 2501 8.09
9 2502 4.81
10 2621 5.62
11 2751 7.74
12 2803 6.79
13 3025 7.84
14 3296 8.88
15 4206 10.49
16 4362 12.51
Table 1
Compute the following calculation by writing a MATLAB script called Question5A.m.
i) Create a scatter diagram for the data set, and label the axes and name the figure meaningfully.
Also, comment on whether there is any association between the drilling cost and the well depth e.g. strong or weak correlation and positive or negative relationship.

ii) Find the regression model (via Ordinary Least Squares estimates of π›½αˆ˜ΰ¬΄ and π›½αˆ˜ΰ¬΅) with cost as the dependent variable and depth as the explanatory or independent variable. State any assumptions you made and comment on whether you believe your equation is a good fit e.g. sum of errors and proportion of variance explained.

iii) An alternate implementation would be to use the MATLAB polynomial curve-fitting function e.g. polyfit and polyval, to compute the Ordinary Least Squares estimates of π›½αˆ˜ΰ¬΄ and π›½αˆ˜ΰ¬΅. Repeat the task in (ii) again, but this time with using the built-in functions. Plot the resulting linear regression model with the data set, and label the axes and name the figure meaningfully.

iv) What cost would you predict for an oil well of 4000m?

v) What is the estimate of the error variance?

vi) What could you say about the cost (predicted) of an oil well of depth 6500m?

Question 5B : MATLAB Computation
A regression model can also be computed using other numerical methods e.g. Gradient Descent to obtain the curve-fitting parameters πœƒ (similar to the 𝛽 from Ordinary Least Squares method). Compute the following calculation by writing a MATLAB script called Question5B.m.

i) Repeat Question 5A (iii) by determine a regression model using Gradient Descent and the provided MATLAB bespoke function m-file (e.g. GradientDescent.m and ComputeCost.m) to compute the estimates of πœƒΰ· ΰ¬΄ and πœƒΰ· ΰ¬΅. Plot the resulting regression model with the data set (e.g. drilling cost vs well depth) and re-plot the regression model obtained from using Ordinary Least Squares, and label the axes and name the figure meaningfully.

ii) What cost would you predict for an oil well of 4000m (using Gradient Descent)?

iii) Evaluate on both Ordinary Least Squares and Gradient Descent approaches in regression modelling. For example, comment on the algorithms’ complexity, ease of implementation, computational efficiency, effectiveness, error rate and etc

Phase 2: System Modelling and Simulation
An Heat Recovery Ventilator (HRV) is constructed to exhaust air passage from the indoor side to the outdoor side (RA β†’ EA) and the fresh air passage from the outdoor side to the indoor side (IA β†’ SA) cross, as illustrated in figure 1.

Figure 1: HRV core
The heat recovery efficiency of an HRV system depends not only on the efficiency of the unit itself, but also on the intake and exhaust ducts that connect the HRV unit to the outside environment. A typical HRV system installed is illustrated in figure 2. Often these intake and exhaust ducts are neglected in heat loss calculations, as their impact on the overall heat recovery efficiency of an HRV is well investigated. Recent research (Marsik et al., 2021) suggested of possible reduction of overall heat
recovery efficiency for up to 20% with suboptimal arrangement of these ducts.

Figure 2: HRV system (unit and ducts)
Phase 2 is about implementing a mathematical model (Marsik et al., 2021) for the overall heat (sensible or temperature) recovery efficiency of an HRV system that accounts for the intake and exhaust ducts. In which, the research suggested the model allows for more correct ventilation heat loss calculations compared to using the heat recovery efficiency of the HRV unit alone.

To better understand the mathematical model, you are required to construct and implement the model in Simulink and MATLAB. A series of simulations will be required to identify the impact of the ducts’ parameters (e.g. inner diameter, thermal insulance and their lengths), and validate them using experimental data.

Phase 2 activities includes:
i. Model and simulate the mathematical algorithms (e.g. Eqn. 1 and Eqn. 2) in Simulink environment for three HRVs using the parameters given in Appendix A:

a. Using ONLY Simulink blocks

b. Adopting the β€˜hybrid’ implementation approach by modelling the algorithms in
Simulink and with MATLAB well integrated into the simulation.

π‘›π»π‘…π‘‰π‘ π‘¦π‘ π‘‘π‘’π‘š (%) = π‘‡π‘–π‘›βˆ’π‘‡π‘ π‘¦π‘ π‘‘π‘’π‘š_𝑒π‘₯β„Žπ‘Žπ‘’π‘ π‘‘
π‘‡π‘–π‘›βˆ’π‘‡π‘œπ‘’π‘‘
Γ— 100 Eqn. 1

π‘›π»π‘…π‘‰π‘ π‘¦π‘ π‘‘π‘’π‘š (%) = 𝑛𝐻𝑅𝑉_π‘’π‘›π‘–π‘‘π‘’βˆ’ πœ‹
πœŒπΆπ‘π‘„(π·π‘–π‘›π‘‘π‘Žπ‘˜π‘’π‘™π‘–π‘›π‘‘π‘Žπ‘˜π‘’
π‘…π‘–π‘›π‘‘π‘Žπ‘˜π‘’ + 𝐷𝑒π‘₯β„Žπ‘Žπ‘’π‘ π‘‘π‘™π‘’π‘₯β„Žπ‘Žπ‘’π‘ π‘‘
𝑅𝑒π‘₯β„Žπ‘Žπ‘’π‘ π‘‘ ) Γ— 100 Eqn. 2

(Hint! Full derivation of Eqn. 1 can be found in Appendix B, and might potentially be useful in your modelling).

ii. Evaluate and comment both modelling approaches as in (i) i.e. Simulink ONLY or Simulink with MATLAB embedded, in term of:
a. Ease of implementation (e.g. modelling)

b. Effectiveness of simulation

iii. Evaluate and comment on temperature or heat (sensible) recovery efficiency algorithms i.e. Eqn. 1 and Eqn. 2 on the following:
a. Assumptions made

b. Modelling and simulation errors and/or uncertainties

c. Limitation and/or restriction

iv. Evaluate the impact of the intake and exhaust ducts’ parameters towards the overall heat recovery efficiency.
a. Plotting the HRV system’s efficiency against these parameters (e.g. inner diameter,
thermal insulance and ducts’ lengths). Elaborate and discuss on your findings.

b. Plotting the HRV system’s efficiency against the airflow rate. Elaborate and discuss on your findings.

v. Comment on your findings about the heat recovery efficiency (%) of an HRV e.g.
π‘›π»π‘…π‘‰π‘ π‘¦π‘ π‘‘π‘’π‘š vs 𝑛𝐻𝑅𝑉𝑒𝑛𝑖𝑑 .

vi. Accordingly to your findings and analysis in (iv), suggest a set or range of optimal
parameters for designing a highly efficient HRV system, and what would be the minimum power requirement for your design. Discuss on the decision you made.

(Hint! Thinking along the power required to operate both motors, and simulation
parameters obtained in (iv)

Evaluate on both Ordinary Least Squares and Gradient Descent approaches in regression modelling.
Scroll to top