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 `pinv(A)` compute when A is not square?
Answer: The Moore-Penrose pseudoinverse of A
pinv computes the Moore-Penrose pseudoinverse, which provides a least-squares solution for non-square or singular matrices.
Which MATLAB command creates a 5x5 matrix of uniformly distributed random numbers?
Answer: rand(5)
rand(5) generates a 5x5 matrix with values uniformly distributed between 0 and 1.
What is the MATLAB syntax to flip a matrix A left-to-right?
Answer: fliplr(A)
fliplr reverses the order of columns, effectively reflecting the matrix horizontally.
How do you compute the condition number of matrix A in MATLAB?
Answer: cond(A)
cond(A) returns the 2-norm condition number, which indicates sensitivity of the solution to perturbations.
What does `kron(A, B)` compute in MATLAB?
Answer: The Kronecker tensor product of A and B
kron computes the Kronecker tensor product, replacing each element of A with that scalar times B.
What is the output of `sum(eye(4))` in MATLAB?
Answer: [1 1 1 1]
sum operates column-wise by default; each column of eye(4) has exactly one 1, so the result is [1 1 1 1].
Which MATLAB function computes the singular value decomposition of a matrix A?
Answer: [U, S, V] = svd(A)
svd(A) returns unitary matrices U and V and a diagonal matrix S of singular values such that A = U*S*V'.