I'm considering the following simple system model:
$$\mathbf{y}=\mathbf{Hx}+\mathbf{n}\quad\textrm{with}\quad \mathbf{n} \sim \mathcal{CN}(\mathbf{0},\mathbf{I})$$
The resulting MIMO channel capacity for known and constant $\mathbf{H}$ should be:
$$C = \log_2\det\left(\mathbf{I}+\mathbf{HQH}^H\right)$$
where $\mathbf{Q}$ denotes the covariance matrix of $\mathbf{x}$.
In my opinion the channel capacity should be real valued. But if I simulate it in MATLAB and compute the capacity I obtain a complex capacity. I generate a random complex $\mathbf{H}$ since $\mathbf{H} \in \mathbb{C}^{n \times n}$ and chose a random covariance matrix $\mathbf{Q} \in \mathbb{C}^{n \times n}$ which is symmetric and positive semi-definite.
Am I doing something wrong in MATLAB or do I violate and conditions, constraints or rules?
My Matlab code is:
%% Init
N = 2;
% Generate complex random channel H
H = sqrt(1) * (randn(N,N)+1i*randn(N,N));
% Generate complex, symmetric positive semidefinite Q
Q = [1,complex(3,-7);complex(3,-7),13];
%% Check if Q is a valid covariance matrix
% Check if Q is symmetric
sym = issymmetric(Q)
% Check if Q is positive definite
psd = all(eig(0.5*(Q+Q'))>=0)
%% Compute capacity
C = log2( det(eye(N,N) + H\*Q\*H' ) )