Matrix and Vector Operations Flashcards
7 cards from real MATLAB practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Matrix and Vector Operations flashcards as text
What does `norm(v, Inf)` compute for a vector v in MATLAB?
Answer: The maximum absolute value of any element
The infinity norm of a vector is the maximum of the absolute values of its elements.
Given A is a 3x4 matrix, what is the size of `A' * A`?
Answer: 4x4
A' is 4x3, so A'*A is (4x3)*(3x4) = 4x4.
Which MATLAB function performs LU decomposition of matrix A?
Answer: lu(A)
lu(A) returns lower and upper triangular factors L and U such that A = L*U (with optional permutation).
What does `cross([1 0 0], [0 1 0])` return in MATLAB?
Answer: [0 0 1]
The cross product of unit vectors i and j equals unit vector k, which is [0 0 1].
How do you compute the cumulative sum of a vector v in MATLAB?
Answer: cumsum(v)
cumsum returns a vector where each element is the sum of all previous elements including itself.
What is `det` of the matrix [2 0; 0 3]`?
Answer: 6
For a diagonal 2x2 matrix, the determinant is the product of the diagonal elements: 2*3 = 6.
In MATLAB, what does `reshape(1:12, 3, 4)` produce?
Answer: A 3x4 matrix filled column-by-column
reshape fills the output matrix column-by-column from the input data, producing a 3x4 matrix.