Math-203-MID-Term-Spring2021
Math-203-MID-Term-Spring2021
1. As per announced date sheet, the question paper will be delivered to each student through official
student’s email ID by instructor from his / her official UOG Email ID.
2. The student must acknowledge the receipt of question paper (as an email reply) immediately after
receiving the question paper.
3. The student will attempt the paper either by tying on MS Word Document file or hand-written on
white A4 paper on the attached format to prepare the answer book. For the case of hand-written
answer book, the student must write his/her name and put signatures on the bottom of every page.
4. All pages of the answer book should be numbered on bottom.
5. If the answer book is not readable due to low quality, the student will be responsible.
6. The answer sheet should be converted into single non-editable PDF document and saved on name
as Roll No.Course Code_Midterm_Spring 2021 (e.g.;
19011509_001_Math203_Midterm_Spring2021).
7. The student shall send the answer sheet by attaching in reply to the same email to the instructor.
8. The instructor will acknowledge the receipt of the answer book as an email reply to each student.
9. The students may call to the instructors, if there is any difficulty in attaching and sending the
answer sheets.
10. Use only those commands and structures of MatLab, which you have studied till mid-course.
Note: Attempt all questions.
Q1. 𝑑𝑖𝑠𝑝[ 123 ] and 𝑑𝑖𝑠𝑝[ ‘123’ ] result same in Matlab. Just write True or False. [1]
Q2. While printing table in MatLab, ______ command can overcome the issue of aligning values with
the heading. [1]
Q3. Write an expression using linspace that will result in the same as -1: 0.13: 3.91 . [1]
Q4. Write the minimum value of the following function along with the associated values of 𝑥 and 𝑦.
𝑓(𝑥, 𝑦) = (𝑥 + 1.7𝑦 − 6.2)2 + (2𝑥 + 𝑦 − 4.5)2 ; 0 ≤ 𝑥 ≤ 7 , −1 ≤ 𝑦 ≤ 1
Answer only required values, no MatLab commands needed. [1]
Q5. Write a single MatLab command to graph 𝑦 = log(25) / 𝑠𝑖𝑛(𝑥) over the interval 2 ≤ 𝑥 ≤ 5. [1]
Q6. Write maximum two MatLab commands which give the following matrix as output. Do not write
the elements individually. [3]
0 0 2 0 0
0 5 0 1 0]
[
0 0 7 0 0
0 0 0 0 9
Q7. We can find the sum of the harmonic series by using the following formula. [3]
1 1 1 1 1
1 + + + + + ⋯+
2 3 4 5 𝑛
Write a program that ask the user about the number of terms of harmonic series and then print the
sum of the required terms.
Q8. Write a script file that would create a 5 by 5 matrix of random integers ranging from -50 to 100.
From this create another matrix variable which is the middle 3 by 3 part of the original matrix.
Then assign its center value equal to zero. Show the output of the resultant matrix values named
as “Final Matrix” in a column. [3]
Q9. Write a program that plot the following function over the interval [-5 5] along with appropriate
axis labeling and title. [3]
ln(𝑥 ) + 2
𝑦=
𝑥 2 + 2𝑥 − 8
Q10. Write a MatLab program to find the angle between two vectors 𝑟1 = ( 3.7 , 8 , −4 ) and
𝑟2 = ( −2 , 5 , 2 ) as shown in figure. [4]
Q11. a) Write a program that print the following table using fprintf command. [3+1]
____________________________________________________________________________________