MEE1006_MATLAB for Engineers_SET-3
MEE1006_MATLAB for Engineers_SET-3
Enrolment No:
Odd Semester End Term Examination, January 2025
Faculty of Engineering, SAMM
Department of Mechanical Engineering
B.Tech
Course Code: MEE1006/ME1006 Course: MATLAB for Engineers Semester: I
Time: 03 hrs. Max. Marks: 80
Instructions: * All questions are compulsory * Missing data, if any, may be assumed suitably * Calculator is not allowed.
SECTION A (Max. Marks 10)
S.No. Description Marks CO
Q. A1 Choose the MATLAB command for finding out the derivative of the polynomial p? 2 1
a. der(p)
b. polyder(p)
c. derivative(p)
d. None of these
Q. A2 How many times will the loop execute? Coose the correct option. 2 1, 2
for i = 1:0.5:5
end
a. 9 times
b. 10 times
c. 11 times
d. 12 times
Q. A3 What will be the result of 5 < 3 | 7 > 6 in MATLAB? 2 2, 3
a. 1
b. 0
c. true
d. false
Q. A4 What is the output of the following MATLAB code? 2 1, 2
p = [1 2 1];
v = polyval(p, 2);
disp(v);
Page 1 of 3
SECTION B (Max. Marks 30)
Q. B1 Write a MATLAB code to create the following matrices O and P: 6 1, 2
1 1 1 1 2 3
𝑂 = [4 8 10], 𝑃 = [41 51 61]
9 18 27 36 18 9
Write a code to find a matrix ‘Q’ by addition of matrix ‘P’ and transpose of ‘O’, also
write a code to delete the third row from the obtained matrix ‘Q’.
Q. B2 Write a MATLAB code to plot both the functions 𝑦 = 𝑠𝑖𝑛(𝑥) and 𝑦 = 𝑐𝑜𝑠(𝑥) on the 6 1, 2
same graph for the values of x ranging from 0 to 2π. Label the axes as ‘y’ and ‘x’ with
a title of the plot as ‘Sine and Cosine Functions’. Also write a code to show the sine
and cosine functions with red and blue lines respectively.
Q. B3 Write a MATLAB code to plot the function, 𝑓(𝑥) = 𝑥 2 cos (1 + 𝑥 2 ) for ‘x’ in the 6 2
range [0, 2𝜋] using an anonymous function.
Q. B4 Using the MATLAB built-in functions (zeros, ones, eye), create the following matrix 6 1, 4
0 0 0 1 1
0 0 0 1 1
1 0 0 0 0
𝐴= 0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
[0 0 0 0 1]
Q. B5 Write a MATLAB code to create a 5×5 matrix where the (𝑖, 𝑗)th element is 𝑖 2 + 𝑗 2. 6 2, 4
Also perform the following operations:
a. Find the sum of all elements in the matrix.
b. Extract a submatrix consisting of the first three rows and first three columns
Page 2 of 3
SECTION-D (Max. Marks 20)
Q. D1 You are studying the growth of a bacterial population over time, which follows an 10 3, 4
exponential growth pattern. You are given the following data:
Time (hours) 0 1 2 3 4 5
Population 5 10 20 40 80 160
Use MATLAB to fit an exponential curve and predict the population at t=6 hours.
Q. D2 Write a MATLAB script to analyze the cooling of an object using Newton’s Law of 10 3, 4
Cooling. The formula is 𝑻(𝒕) = 𝑻𝒆𝒏𝒗 + (𝑻𝒐 − 𝑻𝒆𝒏𝒗 ) ⋅ 𝒆−𝒌𝒕 , where 𝑻𝒐 is the initial
temperature (100 °C), 𝑻𝒆𝒏𝒗 is the environmental temperature (20 °C), ‘k’ is the
cooling constant (0.02), and ‘t’ is time in seconds (0 sec). Use a while loop to compute
and display the temperature every second until it drops below 5 °C above the
environment.
Page 3 of 3