EML2201/EBS3221 End Semester Examination
SRI LANKA TECHNOLOGICAL CAMPUS
BACHELOR OF SCIENCE HONOURS IN IN MECHATRONICS
/ BIO SYSTEMS ENGINEERING
YEAR 2 – SEMESTER 2 – August 2023
End–Semester Examination
EML2201/EBS3221 – Applied Mathematics Laboratory
2 Hours and 30 Minutes
Answer all Questions
No. of Questions: 04
No. of Pages: 6 (including the cover page)
Important Instructions to the Candidates
• Create a folder with your registration number and save the answers (MATLAB commands) for
each main question in a separate .m file (e.g., for Question 1, answers saved in Q1.m).
• Within each .m file (say Q1.m), provide comments to identify the answers (MATLAB commands)
to each sub-question.
• All the output figures (plots) should be inserted into a MS-Word file, and the file should be saved
inside the folder with your registration number.
• At the end of the exam, please ZIP (compress) the folder with your registration number and upload
it to the Moodle submission page. The ZIP folder should contain all .m files and a MS-Word file
with all output figures.
• Candidates must not seek, give or receive assistance during the exam.
• Candidates are requested to adhere to the examination guidelines circulated.
Page 1 of 6
EML2201/EBS3221 End Semester Examination
Question 1
i. The current I (in amps) at time t (in seconds), after closing the switch in the circuit shown in
Figure 1.1 is:
𝑉
𝐼 = (1 − 𝑒 −(𝑅⁄𝐿)𝑡 )
𝑅
Given V = 150 V, R = 250 Ω, and L = 0.5 H, calculate the current for t = 0, 0.001, 0.002,
0.003, 0.004, and 0.005 s after the switch is closed.
Figure 1.1
(6 Marks)
ii. The electrical circuit shown in Figure 1.2 consists of resistors and voltage sources.
Figure 1.2
V1 = 100 V, V2 = 40 V, V3 = 50 V
R1 = 30 Ω, R2 = 6 Ω, R3 = 15 Ω, R4 = 16 Ω, R5 = 27 Ω, R6 = 15 Ω, R7 = 20 Ω, R8 = 35 Ω
Write the corresponding MATLAB commands to find the mesh currents in the circuit based
on Kirchhoff’s voltage law.
Page 2 of 6
EML2201/EBS3221 End Semester Examination
(Note: Meshes are numbered in the figure, and all currents are marked in the clockwise
direction (CW). The mesh equations based on Kirchhoff’s voltage law is given below)
Mesh equations:
Mesh #1 𝑅1 𝑖1 + 𝑅2 𝑖1 − 𝑅2 𝑖4 = 0
Mesh #2 𝑉1 + 𝑅3 𝑖2 − 𝑅3 𝑖5 = 0
Mesh #3 −𝑉3 + 𝑅5 𝑖3 + 𝑅6 𝑖3 − 𝑅5 𝑖5 = 0
Mesh #4 𝑉2 − 𝑅2 𝑖1 + 𝑅2 𝑖4 + 𝑅4 𝑖4 = 0
Mesh #5 −𝑉2 − 𝑅3 𝑖2 − 𝑅5 𝑖3 + 𝑅3 𝑖5 + 𝑅5 𝑖5 + 𝑅7 𝑖5 − 𝑅7 𝑖6 = 0
Mesh #6 𝑉3 − 𝑅7 𝑖5 + 𝑅7 𝑖6 + 𝑅8 𝑖6 = 0
(9 Marks)
iii. Write a program determining the real roots of a quadratic equation 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0. When
the program runs, it asks the user to enter the values of the constants 𝑎, 𝑏, and 𝑐. To calculate
the roots of the equation, the program calculates the discriminant D, given by:
𝐷 = 𝑏 2 − 4𝑎𝑐
If D > 0, the program displays the message “The equation has two roots”, and the roots are
shown in the following line.
If 𝐷 = 0, the program displays the message “The equation has one root” and the roots are
shown in the following line.
If 𝐷 < 0, the program displays the message “The equation has no real roots”
Run the program three times to obtain solutions to the following three equations:
(𝑎) 2𝑥 2 + 8𝑥 + 8 = 0
(𝑏) − 5𝑥 2 + 3𝑥 − 4 = 0
(𝑐) − 2𝑥 2 + 7𝑥 + 4 = 0
(10 Marks)
(Total 25 Marks)
Page 3 of 6
EML2201/EBS3221 End Semester Examination
Question 2
3cos (𝑥) 8sin (𝑥)
i. Plot the function 𝑓(𝑡) = − for -4 ≤ x ≤ 9 with the following properties.
0.9𝑥+𝑒 −0.5𝑥 7
• Line with = 5
(5 Marks)
𝑥 3 −10𝑥−25
ii. Plot the function 𝑓(𝑥) = for -8 ≤ x ≤ 8, with the following properties. Notice
𝑥 2 −𝑥−6
that the function has two vertical asymptotes.
• Line with = 5
• Axis limits (Xmin, Xmax, Ymin, Ymax) = [-9 9 -50 50]
• Mark the X and Y axes on the graph
(10 Marks)
iii. Plot the function 𝑓(𝑥) = sin (2x)𝑐𝑜𝑠(𝑥) and its derivative, both on the same plot for
-π ≤ x ≤ π, with the following properties.
• Plot the function with a solid line in blue colour and the derivative with a dashed
line in red colour
• Add a legend and label the X-axis
• Mark the X and Y axes on the graph
• Tighten the axes to their limits
Note: Create a MS-Word file and insert all the output figures of question 2
(10 Marks)
(Total 25 Marks)
Page 4 of 6
EML2201/EBS3221 End Semester Examination
Question 3
i. Write a program to generate the 1st n of Fibonacci numbers and calculate how many are
even. n is given by the user.
Note: Fibonacci numbers are the numbers in a sequence in which the first two elements
are 0 and 1, and the value of each subsequent element is the sum of the previous two
elements.
Use the program to find the 1st ten Fibonacci numbers and calculate how many are even.
Note: consider zero as an even number.
(9 Marks)
ii. Write a program to create an n × m matrix with the elements that have the following values.
The value of each component of the 1st row is the square (to the 2nd power) of its column
number. The value of each element in the 1st column is the square (to the 2nd power) of its
row number. The rest of the elements each have a value equal to the modulus of the
difference between the element above it and the element left to it. When executed, the
program asks the user to enter values for n and m.
Use the program to compute the output of a 4 x 4 matrix.
(9 Marks)
iii. Write a program using a loop to find the smallest even integer divisible by 13 and whose
square root is greater than 120. The loop should start from 0 and stop when the number is
found.
(7 Marks)
(Total 25 Marks)
Page 5 of 6
EML2201/EBS3221 End Semester Examination
Question 4
i. Write the relevant MATLAB commands to obtain the following.
a. Find the roots of the following polynomial:
3𝑥 4 − 2𝑥 2 − 𝑥 + 15 = 0
(3 Marks)
b. Evaluate:
(12𝑥 3 + 8𝑥 2 + 15)(8𝑥 2 + 10𝑥 − 3)(𝑥 + 7)
(3 Marks)
c. Evaluate:
12𝑥 5 − 7𝑥 2 + 3𝑥 + 15
3𝑥 2 + 9𝑥 + 5
(3 Marks)
d. Evaluate:
5𝑥 3 −2𝑥 2 −𝑥
, when x = 7.0
2𝑥 2 −3𝑥+5
(3 Marks)
e. Plot the data set in Table 4.1 and fit a 4th-order polynomial to the data set.
Table 4.1
x 3 4 5 7 8 9 11 12
y 1.6 3.6 4.4 3.4 2.2 2.8 3.8 4.6
In your plot, you must have;
• Data points marked in circles
• Fitted line (Regression line), a dashed line, in red color
• Axis limits (Xmin, Xmax, Ymin, Ymax) = [2 13 1 6]
• Legend - “Data points” and “Regression line”
Note: Insert the output figure into the MS-Word file.
(8 Marks)
ii. The product of 3 consecutive integers is 10626. Using MATLAB’s built-in functions for
operations with polynomials, determine the 3 integers.
(5 Marks)
(Total 25 Marks)
---End of Question Paper---
Page 6 of 6