# Complex Wishart distribution in Matlab

I'd like to use Matlab to generate random matrices from the complex Wishart distribution with $n$ degrees of freedom.

The wishrnd function in Matlab only generates real Wishart matrices.

What I do now is I generate $n$ random vectors $\mathbf{x}_{i} \sim \mathcal{CN}(\mathbf{0},\mathbf{\Sigma})$, $i=1, \ldots, n$, and then obtain the complex Wishart random matrix as

$$\mathbf{X} = \sum_{i=1}^{n} \mathbf{x}_{i} \mathbf{x}_{i}^{\mathrm{H}}.$$

Is there a way to obtain $\mathbf{X}$ without the above expression?

Observe that, if I generate two Wishart random matrices $\mathbf{A}$ and $\mathbf{B}$ using the wishrnd function, $\mathbf{X} = \mathbf{A} + i \mathbf{B}$ does not follow the complex Wishart distribution (since we should have $\mathbb{E}[\mathbf{X}] = \mathbf{I})$.

• Let me just throw this to the air: if you can generate random real matrices that follow the distribution you want, can't you generate two such random real matrices $A, B$ and then take $X = A + iB$? – RGS Oct 17 '17 at 12:04
• No, please see the explanation in the edited question. – TheDon Oct 17 '17 at 12:12

If you take a look at the wishrnd.m function's code, you'll see a couple of things.

The first is that if the degrees of freedom are less than somewhere around 81 or so, then the method that you described is exactly the method that is used to generate the Wishart. The only thing that needs to change in the code is that instead of

x = (randn(df,size(d,1))*d;

you should be using something like

x = (randn(df,size(d,1)) + 1i*randn(df,size(d,1)))/sqrt(2) * d;

to generate the complex normal draws.

The second method is based on the Bartlett decomposition, and the code specifies a reference of Smith and Hocking (which I frankly never found). An x similar to that used in the real-valued code can be built, but because of the complex nature of the covariance structure, the diagonal elements are not $\chi^2$-variables, but rather Generalized Gamma distributed (see for example Nagar & Gupta, 2011).

If you'd like to use this method (i.e. you need degrees of freedom much greater than 80), then in the code, substitute in for a a correctly sized diagonal matrix whose elements are drawn from the generalized gamma distribution as described in the paper, and away you go!

Nagar, Daya K.; Gupta, Arjun K., Expectations of functions of complex Wishart matrix, Acta Appl. Math. 113, No. 3, 265-288 (2011). ZBL1207.62114.

• If you are still interested on this I have developed a matlab function that generates this complex matrix. It is based on the above answer from aepound, although it uses a univariate (not multivariate) gamma distribution, and the standard Normal samples in the upper triangular portion of the matrix are complex valued. These changes are according to the cited paper. Here is the GH repository link – Andre Oct 25 '18 at 10:40