Clear Filters
Clear Filters

negative eigenvalues in sample covariance matrix

3 views (last 30 days)
yasser
yasser on 10 Oct 2014
Answered: Matt J on 10 Oct 2014
clc; clear;
N=10; taps=2; snr=0; noise_var=0.05;
h1r=randn(1,taps)/sqrt(2); h1i=randn(1,taps)/sqrt(2); h1=complex(h1r,h1i); h1=h1/norm(h1);
h2r=randn(1,taps)/sqrt(2); h2i=randn(1,taps)/sqrt(2); h2=complex(h2r,h2i); h2=h2/norm(h2);
c1=[h1(1);zeros(1,N-1)']; r1=[h1 zeros(1,N-1)]; H1=toeplitz(c1,r1);
c2=[h2(1);zeros(1,N-1)']; r2=[h2 zeros(1,N-1)]; H2=toeplitz(c2,r2);
H=[H1;H2];
order=64; k=log2(order); n=(taps+N-1)*k; x = randi([0 1],n,1); hMod = comm.RectangularQAMModulator(order); hBitToInt = comm.BitToInteger(k);% Convert the bits in x into k-bit symbols. xsym = step(hBitToInt,x); D = modulate(modem.qammod(order),xsym);
X=awgn(H*D,snr,'measured');
% noise1=sqrt(noise_var/2)*(randn(1,size(H1*D,1))+i*randn(1,size(H1*D,2))); % noise2=sqrt(noise_var/2)*(randn(1,size(H2*D,1))+i*randn(1,size(H2*D,2))); % noise=[noise1.';noise2.']; % % X=H*D+noise;
R=X*X'/size(X,2);
[Q ,eig_val]=eig (R);
the problem is that matrix of eig_val has negative values and this can't happen for sample covariance matrix R any help please

Answers (1)

Matt J
Matt J on 10 Oct 2014
I can't run your code, because you haven't provided all variables needed to run it. However, you can expect small magnitude negative eigenvalues due to floating point errors, if your true covariance matrix ix close to singular.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!