Filter löschen
Filter löschen

chol() say matrix is not positive defnite even though all eigenvalues are positive

3 Ansichten (letzte 30 Tage)
Title exaplins it more or less. I need to make the cholesky decomposition of a matrix and the function, chol(), returns an error saying that the matrix is not positive definite.
The code in question:
Qd = [
0.0106, 0.0178;
0.0097, 0.0195
];
chol(Qd)
The Qd matrix is calcualted with through some more complex means but this is one example of a Qd matrix that returns the following outputs:
K>> Qd
Qd =
0.0106 0.0178
0.0097 0.0195
K>> chol(Qd)
Error using chol
Matrix must be positive definite.
K>> eig(Qd)
ans =
0.0011
0.0289
K>>

Akzeptierte Antwort

Steven Lord
Steven Lord am 29 Okt. 2019
You're not factorizing the matrix you think you're factorizing. From the documentation for the chol function: "If A is nonsymmetric , then chol treats the matrix as symmetric and uses only the diagonal and upper triangle of A."
Is your Qd matrix symmetric?
issymmetric(Qd) % false
So what matrix are you actually trying to factorize?
A = triu(Qd) + triu(Qd, 1).'
That matrix is symmetric but is not positive definite.
  1 Kommentar
Morten Nissov
Morten Nissov am 20 Nov. 2019
I completely forgot to check and had just assumed the matrix was symmetric. Thank you, this pointed me towards an underlying problem earlier in the script.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by