MATLAB: How can i split a matrix into product of two matrices in matlab

matrix splitting

I am having a matrix A which is formed by multplying matrix X with it's conjugate transpose (A=X*X'),how can i find matrix X from A?

Best Answer

@John D'Errico
You are right about your comment on singularity of a matrix and positive definiteness.
I assumed that since it was a covariance matrix, it should be positive semi definite. Since the error message is `Matrix must be positive definite`, I concluded that the determinant of the matrix A should be equal to zero and therefore it is not positive definite (it is positive semi definite). So the conclusion must have been that the matrix A is singular, rather than it is not positive definite (although it is still a correct proposition).
What I should have said was:
If the A matrix is not positive definite, ...
"it means that the matrix A is singular, (because it is a covariance matrix, therefore it is positive semi definite)"
... which means that the solution you are looking for is not unique. That is to say, there are many X matrices satisfying A = X*X'.
Hence I was talking about this specific problem, rather than trying to point out a general fact. Sorry for the confusion that I created.
...
But I think the error here is not caused by a complex diagonal element, as you mentioned above, since A = X * X' and as I said many times already it is a covariance matrix. And the error message returned by chol can also be generated by real diagonal inputs as well, by using a singular matrix;
chol([1, 2; 3, 4])
Error using chol
Matrix must be positive definite.
Therefore, my suggestion to use svd will not fail for this problem, because we are dealing with a singular "A" matrix, which is a covariance matrix (A = X*X'), therefore it is Hermitian and is diagonalizable.
But in general, I agree that not every matrix can be decomposed into the form described above (A = X*X'), as your example of a matrix with complex diagonal entry suggests.