Complete the code to compute eigenvalues of matrix A.
A = [2 1; 1 2]; lambda = [1](A);
The eig function computes eigenvalues of a matrix.
Complete the code to compute eigenvectors of matrix B.
B = [4 0; 1 3]; [V, D] = [1](B);
The eig function returns eigenvectors and eigenvalues when called with two outputs.
Fix the error in the code to correctly compute eigenvalues of matrix C.
C = [1 2; 3 4]; lambda = eig[1]C);
The function call syntax requires parentheses around the argument: eig(C).
Fill both blanks to create a dictionary of eigenvalues and eigenvectors for matrix D.
D = [5 2; 2 5]; [V, [1]] = eig(D); eigenvalues = diag([2]);
The second output of eig is the diagonal matrix of eigenvalues, so D is assigned to {{BLANK_1}}. To get eigenvalues as a vector, use diag(D).
Fill all three blanks to compute eigenvalues and eigenvectors, then normalize eigenvectors of matrix E.
E = [3 1; 0 2]; [[1], [2]] = eig(E); norm_vec = [3]( [1](:,1) );
eig returns eigenvectors and eigenvalues. We assign eigenvectors to V and eigenvalues to D. To normalize the first eigenvector, use norm(V(:,1)).