Birla Institute of Technology & Science, Pilani Work-Integrated Learning Programmes Division First Semester 2012-2023 MID SEM Examination (EC-2 REGULAR) Course No. Course Title Nature of Exam Weightage Duration Date of Exam : PE ZC164 : COMPUTER PROGRAMMING : Open Book : 30% : 3 Hours : Sunday, 25/09/2022 (FN) No. of Pages =2 No. of Questions = 5 Note: 1. Please follow all the Instructions to Candidates given on the cover page of the answer book. 2. All parts of a question should be answered consecutively. Each answer should start from a fresh page. 3. Assumptions made if any, should be stated clearly at the beginning of your answer. 4. No need for calculations, only commands and logics is desired wherever necessary. Q.1) Write the equivalent statement (only expressions no calculations) in MATLAB for the necessary mathematical formula (a) 3 4 7 π₯π¦ + 8 π¦ 2 + √π₯ + π¦ (b) π ππ2 800 − (πππ 150 .π ππ80) 3 √0.18 [1 Mark] [1 Mark] (c) Write an expression to calculate total amount received for principal of Rs. 1000 Deposited for 5 years at 15% per year with the interest compounded monthly. [1 Mark] (d) Use MATLAB array operations on the vector n to set up the following four vector 1, 1/22, 1/32, 1/42, 1/52 (e) 14π −0.1π‘ sinβ‘(2ππ‘) [1 Mark] [1 Mark] Q.2) Given that a = [1 0 2] and b = [0 2 2] Determine the values of the following expressions. (a) a ˜= b [1 Mark] (b) a<b<a [1 Mark] (c) b & (˜b) [1 Mark] (d) a = b == a [1 Mark] (e) a>b [1 Mark] Q.3) Short Questions (a) Generate a 2 x 6 matrix variable mat. Replace the first row with 1:6. Replace the third column with any different values mat = 2 3 4 5 1 4 11 3 [2 Mark] (b) Generate a 2 x 3 matrix of random numbers from 0 to 2 and 5 to 10 using two single statements [2 Mark] (c) Create a vector x which consists of 30 equally spaced points in the range from –ο° to +ο°. and create a y vector which is cos(x). [2 Mark] (d) Find the following sum by first creating vectors for the numerators and denominators Write only commands with explanation 3 5 7 9 + + + 1 2 3 4 [2 Mark] (e) Create a column vector in which the first element is 26, the elements decrease with increments of -3.6, and the last element is -10. (A column vector can be created by the transpose of a row vector. ) [2 Mark] Q.4) MATLAB SCRIPT WRITING Write a generalized MATLAB function for all Newtonian fluid to calculate the value of Reynolds number. The sample problem statement is given here. Sample Problem Statement: A Newtonian fluid having a viscosity of 0.38 N.s/m2 and specific gravity of 0.91 flows through a 25 mm diameter pipe with a velocity of 2.6 m/s. Determine the value of Reynolds’ number in SI Units. The fluid density is calculated from specific gravity: p = S x density of water = 0.91 x 1000 = 910 Kg/m 3 [5 Mark] Q.5) MATLAB SCRIPT WRITING Generate a Plot for the three equations, all three plots should be in one plot π¦1 = sin π‘, π¦2 = π‘ and π¦3 = π‘ − π‘3 3! + π‘5 5! [5 Mark]