Proposed Questions For Arrays and Matrices in MATLAB
Proposed Questions For Arrays and Matrices in MATLAB
---------------------------------------
A = [1 2 3; 4 5 6; 7 8 9];
B = A(2:end, 1:2);
---------------------------------------
a) B = [2 3; 5 6; 8 9]
b) B = [1 2; 4 5; 7 8]
c) B = [4 5; 7 8; 9]
d) B = [2 3; 5 6]
*Answer: a) B = [2 3; 5 6; 8 9]*
*Answer: a) C = [1 2; 3 4; 5 6; 7 8]*
*Answer: b) B = [1 3; 2 4]*
*Answer: a) B = [4 6]*
*Answer: a) B = [1 2; 4 5]*
10. How can you compute the dot product of two vectors in MATLAB?
a) Using the ‘dot’ function.
b) Using the ‘.*’ operator.
c) Using the ‘cross’ function.
d) There is no built-in function for computing the dot product.
*Answer: a) B = [4 5; 6 7]*
12. How can you find the maximum element in a matrix along a specified dimension in MATLAB?
a) Using the ‘max’ function.
b) Using the ‘maxelement’ function.
c) Using the ‘maxdim’ function.
d) There is no built-in function for finding the maximum element along a specified dimension.
*Answer: a) C = [1 2; 3 4]*
15. How can you compute the element-wise square root of a matrix in MATLAB?
a) Using the ‘sqrt’ function.
b) Using the ‘.^’ operator.
c) Using the ‘power’ function.
d) There is no built-in function for computing the element-wise square root.
*Answer: a) B = [1 4; 9 16]*
*Answer: a) B = [2 4]*
20. How can you compute the element-wise division of two matrices in MATLAB?
a) Using the ‘/’ operator.
b) Using the ‘./’ operator.
c) Using the ‘div’ function.
d) There is no built-in function for element-wise division.
*Answer: a) B = [3 4; 1 2]*
*Answer: a) B = [3 2 1; 6 5 4; 9 8 7]*