Factors a positive semi-definite matrix, A
, into an
upper-unitriangular matrix, U
, and diagonal matrix with elements in d
such that:
U * diag(d) * U.' == A
This function is nearly identical to ldfactor
. See that function for
more.
A | Positive, semi-definite matrix |
---|---|
tol | Division tolerance; when divisors are below this value, no division will actually take place. |
U | Upper unitriangular matrix |
---|---|
d | Vector of diagonals |
nz | Number of zero diagonals found during factorization |
Generate a random covariance matrix.
Break it down to U
and d
.
P = randcov(3)
[U, d] = udfactor(P)
P =
0.5052 -0.2311 -0.2059
-0.2311 0.5124 -0.0714
-0.2059 -0.0714 0.7502
U =
1.0000 -0.4959 -0.2744
0 1.0000 -0.0951
0 0 1.0000
d =
0.3243
0.5056
0.7502
Reconstruct the original matrix
U * diag(d) * U.'
ans =
0.5052 -0.2311 -0.2059
-0.2311 0.5124 -0.0714
-0.2059 -0.0714 0.7502
Stengel, Robert F. Optimal Control and Estimation. New York: Dover Publications, Inc. 1994. Print. Page 360.
ldfactor, ld2mat, ud2mat, sqrtpsdm
*kf
v1.0.3