0
0
MATLABdata~20 mins

Singular value decomposition (svd) in MATLAB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SVD Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of SVD on a simple matrix
What is the output of the following MATLAB code snippet?
MATLAB
A = [3 1; 1 3];
[U,S,V] = svd(A);
disp(diag(S)');
A[2 4]
B[4 2]
C[5 1]
D[3 3]
Attempts:
2 left
💡 Hint
Recall that singular values are the square roots of eigenvalues of A'*A.
🧠 Conceptual
intermediate
1:30remaining
Properties of matrices in SVD
Which statement about the matrices U, S, and V from the SVD of a matrix A is correct?
AU and V are orthogonal matrices, and S is a diagonal matrix with non-negative entries.
BU and V are diagonal matrices, and S is an orthogonal matrix.
CU is upper triangular, V is lower triangular, and S is symmetric.
DU and V are symmetric matrices, and S is a diagonal matrix with negative entries.
Attempts:
2 left
💡 Hint
Think about the definition of orthogonal matrices and singular values.
🔧 Debug
advanced
2:30remaining
Identify the error in SVD reconstruction
What is the error in the following MATLAB code that attempts to reconstruct matrix A from its SVD?
MATLAB
A = [1 2; 3 4];
[U,S,V] = svd(A);
A_reconstructed = U * S * V;
disp(A_reconstructed);
AThere is no error; the code reconstructs A correctly.
BThe svd function returns V transposed, so V should be transposed again.
CThe multiplication order is incorrect; it should be U * S * V'.
DThe matrix S is not diagonal, so reconstruction fails.
Attempts:
2 left
💡 Hint
Recall the formula for reconstructing A from U, S, and V.
📝 Syntax
advanced
1:30remaining
Syntax error in SVD usage
Which option contains a syntax error when performing SVD in MATLAB?
A[U,S,V] = svd A;
B[U,S,V] = svd(A);
C[U,S,V] = svd(A, 'econ');
D[U,S,V] = svd(A,0);
Attempts:
2 left
💡 Hint
Check the correct syntax for function calls in MATLAB.
🚀 Application
expert
2:00remaining
Number of singular values greater than a threshold
Given matrix A, how many singular values are greater than 1.5 in the following code?
MATLAB
A = [4 0 0; 0 3 0; 0 0 0.5];
[~,S,~] = svd(A);
sv = diag(S);
count = sum(sv > 1.5);
A0
B3
C1
D2
Attempts:
2 left
💡 Hint
Look at the diagonal entries of S and count those greater than 1.5.