MATLAB: Complex matrix with real elements on the diagonal

matrix

Hi,
I have a complex matrix that have almost real value on the diagonal (5.8077e-10 – 1.2925e-26i this is one value for example), I know that theoretically the elements on the diagonal should be perfectly real so that I can apply the cholesky decomposition. My question is, is it possible to force the diagonal to take only the real part while the remaing values of the matrix are complex? I tried doing
C – diag(C)+real(diag(C)) but it didn't works the elements on the diagonal are still complex
Thank you for your time.

Best Answer

You can do,
C=(C+C')/2;