Bird
0
0

What is the output of the following MATLAB code?

medium📝 Predict Output Q4 of 15
MATLAB - Linear Algebra
What is the output of the following MATLAB code?
A = [4 1; 2 3]; [V,D] = eig(A); disp(D);
A[3 0; 0 4]
B[5 0; 0 2]
C[1 0; 0 6]
D[4 1; 2 3]
Step-by-Step Solution
Solution:
  1. Step 1: Calculate eigenvalues of matrix A

    Matrix A = [4 1; 2 3]. The characteristic polynomial is |A - \u03BBI| = 0.
    Calculate: (4-\u03BB)(3-\u03BB) - 2*1 = 0
    \u03BB^2 - 7\u03BB + 10 = 0
  2. Step 2: Solve quadratic equation for eigenvalues

    Roots are \u03BB = 5 and \u03BB = 2.
    So, D = diag([2 5]) or diag([5 2]) depending on MATLAB ordering.
  3. Final Answer:

    Diagonal matrix with eigenvalues 5 and 2 -> Option B
  4. Quick Check:

    Eigenvalues = 5, 2 [OK]
Quick Trick: Eigenvalues are roots of characteristic polynomial [OK]
Common Mistakes:
  • Mixing eigenvalues with matrix elements
  • Incorrectly solving characteristic polynomial

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes