A question about the matlab function chol().

561 views
Skip to first unread message

叶超天

unread,
Sep 29, 2014, 6:07:42 AM9/29/14
to yal...@googlegroups.com
It is easy to see that the following x is generally a semi-definite matrix,(in fact, definite in this special case).
But when I use chol() in the program, the program stops and tells me that "??? Error using ==> chol
Matrix must be positive definite with real diagonal."  
Then how to solve this problem? Thank you!

>> x=phi*phi'+Ipsi_1C*Ipsi_1C'+inv(V)*inv(V)'

x =

  1.0e+002 *

  Columns 1 through 5

   0.5655 + 0.0000i   0.0458 + 0.0190i  -0.0016 + 0.0295i  -0.0181 + 0.0338i   0.0049 - 0.0001i
   0.0458 - 0.0190i   2.9353 + 0.0000i  -0.0017 + 0.0037i  -0.0116 + 0.0449i  -0.0048 - 0.0133i
  -0.0016 - 0.0295i  -0.0017 - 0.0037i   1.0508 + 0.0000i   0.0089 - 0.0063i   0.0052 - 0.0041i
  -0.0181 - 0.0338i  -0.0116 - 0.0449i   0.0089 + 0.0063i   1.8672 + 0.0000i  -0.0035 + 0.0027i
   0.0049 + 0.0001i  -0.0048 + 0.0133i   0.0052 + 0.0041i  -0.0035 - 0.0027i   2.0895 - 0.0000i
  -0.0315 - 0.0042i  -0.0432 - 0.0430i  -0.0065 + 0.0037i   0.0280 - 0.0163i  -0.0059 + 0.0111i

  Column 6

  -0.0315 + 0.0042i
  -0.0432 + 0.0430i
  -0.0065 - 0.0037i
   0.0280 + 0.0163i
  -0.0059 - 0.0111i
   2.6429          


Johan Löfberg

unread,
Sep 29, 2014, 6:09:30 AM9/29/14
to yal...@googlegroups.com
Hint:

>> chol(1+1e-15*sqrt(-1))
Error using chol

叶超天

unread,
Sep 29, 2014, 6:20:52 AM9/29/14
to yal...@googlegroups.com
I know this is caused by precision and the exist of imag part, so I figured a solution like x=x-diag(diag(x))+diag(diag(real(x))), Is there any better solution?

Johan Löfberg

unread,
Sep 29, 2014, 6:36:24 AM9/29/14
to yal...@googlegroups.com
No (except the simplification x = x - diag(imag(diag(x))). x = (x+x')/2 might work too)

叶超天

unread,
Sep 29, 2014, 7:33:47 AM9/29/14
to yal...@googlegroups.com
Good idea.   x = (x+x')/2 .
Thank you very much. Your answer is just what I want.
Reply all
Reply to author
Forward
0 new messages