Search code examples
matlabgmm

mvnpdf() yields SIGMA mustbe a aquare, symetric, positive definite matrix


I have a matrix:

sigma=[0.1085 0.1085 0.1085;
       0.1085 0.1085 0.1085;
       0.1085 0.1085 0.1085];

I am reciving the following errpr: SIGMA mustbe a aquare, symetric, positive definite matrix for the e line:

mvnpdr(rgb_pt,mu,sigma);

As best I can understand from here this unsweres the demands. Am I correct? If so what is the problem here?


Solution

  • The problem is sigma is not positive definite. To verify this, use the code provided here.

    >> sigma=[0.1085 0.1085 0.1085;
           0.1085 0.1085 0.1085;
           0.1085 0.1085 0.1085];
    >> [~,p] = chol(sigma)
    
    p =
    
         2