gusucode.com > ​多天线系统的各种信号检测算法matlab源码程序 > MIMO_detection/channel_generator.m

    function [H]=channel_generator(Rx,Tx,corr_amp,corr_phase)
%generate the correlated channel

%the reference can be found in the following paper
%Performance of zero-forcing detectors over MIMO flat-correlated Ricean
%fading channels.

%generate Hw
Hw=zeros(Rx,Tx);
for rx=1:Rx
    for tx=1:Tx
        x1=1+j;
        x=awgn(x1,0); %model:Y = AWGN(X,SNR),The SNR is in dB,If X is complex, then AWGN adds complex noise
        x=x-x1;
        Hw(rx,tx)=x;
    end
end
Hw;


corr_phase=corr_phase/180*pi;
r=corr_amp*(cos(corr_phase)+j*sin(corr_phase));

Rt=zeros(Tx,Tx);

for m=1:Tx
    for n=1:Tx
        if m>n
           Rt(m,n)=r^(m-n);
        else
           Rt(m,n)=(r')^(n-m); 
        end
    end
end
Rt;
[v,d]=eig(Rt);%produces a diagonal matrix D of eigenvalues and a
             %full matrix V whose columns are the corresponding eigenvectors so
             %that Rt*V = V*D
A=v*sqrt(d)*v';  %sqrt(d):every element in the matrix d is sqrted
H=Hw*A;

return;