How to Check Positive Definites in MATLAB

104 6

    Check with EIG

    • 1). Define a matrix in the usual manner with MATLAB. For example, "A = [1 2; 3 4]" will produce:

      A =

      1 2

      3 4

    • 2). Type "EIG(A)" and hit "Enter." MATLAB produces all the eigenvalues of the matrix. For the matrix defined in the previous step, MATLAB outputs:

      ans =

      -0.3723

      5.3723

    • 3). Inspect the output. Only if all values are positive is the matrix positive definite. The matrix in the previous step is not positive definite.

    Check with CHOL

    • 1). Define a matrix in the usual manner with MATLAB. For example, "A = [1 2; 3 4]" will produce:

      A =

      1 2

      3 4

    • 2). Type "[R,p] = chol(A)". For matrix "A" in the previous step, MATLAB outputs the following:

      R = 1

      p = 2

    • 3). Inspect the result -- specifically, the value of "p". Only if "p" is zero is the matrix positive definite. Matrix "A" in the previous step is not positive definite.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.