0% found this document useful (0 votes)
121 views5 pages

Midterm Model Exam

This document contains a model question paper for a midterm exam with 7 multiple choice and short answer questions. The questions cover topics like using MATLAB commands like linspace, sort, and min to manipulate vectors and arrays. They also involve using commands like fplot, plot, and scripts to graph functions and their derivatives. The total points for the exam are 20 points distributed across the questions.

Uploaded by

ii .7us
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views5 pages

Midterm Model Exam

This document contains a model question paper for a midterm exam with 7 multiple choice and short answer questions. The questions cover topics like using MATLAB commands like linspace, sort, and min to manipulate vectors and arrays. They also involve using commands like fplot, plot, and scripts to graph functions and their derivatives. The total points for the exam are 20 points distributed across the questions.

Uploaded by

ii .7us
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Model Question Paper Midterm (EEN 170)

Name:

Section: ID No:

For official use only

Question NO.
Total Points Points

Q1 5
Q2 2
Q3 2
Q4 2
Q5 2
Q6 3
Q7 4

Total 20

With my best wishes


Q1 (Choose the correct answer for the following questions. )

1) Using the linspace command, create a row vector with 5 elements


that are all 9.

a) linspace(9,9,5) b) linspace(0,9,5)

c) linspace(0,5,9) d) linspace(5,9,9)

2) If vector A= [1 6 -15 80 5 17 4 -49], arranges the elements in


ascending order by using matlab built in function.

a) ascend(A) b) sort(A)

c) order(A) d) inv(A)

3) What is the result of the following code?

>> A= [-5 9 2 0 -18 6 4 11 -18];

>> [d,n]=min(A)
a) d=-18,n=9 b) d=-18,n=5

c) d=5,n=-18 d) d=9,n=-18
4) If matrix A= [3 6;-5 8], find the determinant of square matrix A,
using matlab built in function.
a) det(A) b) sort(A)

c) mean(A) d) inv(A)

5) What is the output of the following code?

>> x = -9/4;

>> floor(x)
a) 3 b)-3 c)-2.25 d) 2.25
Q2) Solve the following system of three linear equations:

7x – 2y + 5z = –17.5
– 4.5x+2y+ 3z = 5.5
7x – 9y- z = 10
Matlab Command:

Q3) Using the zeros, ones, and eye commands, create the following array by
0 1 0
typing one command: [0 0 1]
1 1 1

Q4) For the function y = x2- e0·5x + x , calculate the value of y for the following

values of x using element-by-element operations: -2,-1, 0,1,2, 3, 4,.

Matlab Command:
Q5) Use the fplot command to plot the function: f(x) = (sin2x + cos25x) e -0.2x in
the domain -6 ≤ x ≤ 6. Add a legend and label the axes.

Matlab Command:

-x -x -x
Q6) Plot the function f(x) = x2e and its derivative f’(x) = 2x e - x2e for
0 ≤ x ≤ 10 in one plot. Plot the function with a solid line, and the derivative with a
dashed line. Add a legend and label the axes.

Scripts:
Q7 (Answer any four of the following questions)

20 −6 1 7 6
Given matrix A= [ 6 9 10 2 9] , choose the MATLAB commands
5 14 6 2 0
10 −1 0 5 3
for the following questions

1) Select all elements in the first two rows and the third (3rd) and
fifth (5th) columns of A.

a) A(1:2,3:5) b) A(1:2,[3 5])

c) A([1 2],3:5) d) A(1:2,[3,4,5])

2) Find the sum of the third (3rd) column of matrix A.

a) sum(A(:,3)) b) sum(A(3,:))

c) sum(A,3) d) sum(A(3,3))

3) Remove second row of matrix A.

a) A(2,:)={} b) A(:,2)={}

c) A(:,2)=[] d) A(2,:)=[]

4) Create a matrix C from Matrix A as size 2 by 10.

a) reshape(A,2,10) b) reshape(A,10,2)

c) reshape(A(10,2)) d) reshape(A(2,10)

5) Add vector B=[5 7 -3 6 ] as a sixth column of matrix A

a) A(6,:)=B b) A(6,:)=B’

c) A(:,6)=B d) A(:,6)=B’

You might also like