Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to perform singular value decomposition on matrix A.
MATLAB
[U, S, V] = [1](A); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using eigenvalue function
eig instead of svd.Trying to invert the matrix with
inv.✗ Incorrect
The svd function in MATLAB computes the singular value decomposition of a matrix.
2fill in blank
mediumComplete the code to extract the singular values from matrix A.
MATLAB
S = [1](A); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
eig which returns eigenvalues, not singular values.Using
rank or det which do not return singular values.✗ Incorrect
The svd function returns singular values when called with one output.
3fill in blank
hardFix the error in the code to compute the SVD of matrix B.
MATLAB
[U, S, V] = svd([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase
b instead of B.Adding parentheses or brackets after the variable name.
✗ Incorrect
Variable names in MATLAB are case-sensitive. Use B exactly as defined.
4fill in blank
hardFill both blanks to create a diagonal matrix of singular values and reconstruct matrix A.
MATLAB
S = diag([1]); A_reconstructed = [2] * S * V';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
S instead of the vector s for diag.Using
V instead of U for reconstruction.✗ Incorrect
The vector of singular values is s. The matrix U is used to reconstruct A with S and V.
5fill in blank
hardFill all three blanks to compute the reduced SVD of matrix M.
MATLAB
[[1], [2], [3]] = svd(M, 'econ');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
E which is not a standard output of svd.Mixing the order of
U, S, and V.✗ Incorrect
The reduced SVD returns U, S, and V matrices.