Search code examples
matlabmathmatrixlinear-algebraalgebra

In MATLAB, how to generate a complex positive definite matrix whose diagonal elements belong to the interval (0,1]?


I am currently using the following code to generate a real positive definite matrix of size n.

A = (mvnrnd(zeros(n,1), eye(n), n))';

How do I generate for complex entries with the same constraint that all the diagonal elements are between (0,1]?


Solution

  • I tried something and get this:

    A = (mvnrnd(zeros(n,1), eye(n), n))'
    A = A+A'
    A = A + 4*n*eye(n)
    C = rand(n)
    C=C-C'
    D = A+i*C
    chol(D)
    

    Using your distribution parameters generate random A matrix. Make this symmetric, add elements at main diagonal, create complex part, sum them. This describes a 4sigma probability interval of getting positive define matrix. But my method has one weak point - it based on symmetric and skew-simmetric matrices. Is it ok for you?