基于Matlab的MIMO通信系统仿真

1. MIMO基本原理

    MIMO技术指在发射端和接收端分别使用多个发射天线和接收天线,使信号通过发射端与接收端的多个天线传送和接收,从而改善通信质量。它能充分利用空间资源,通过多个天线实现多发多收,在不增加频谱资源和天线发射功率的情况下,可以成倍的提高系统信道容量,显示出明显的优势、被视为下一代移动通信的核心技术。

2. 空时分组码

2.1 Alamouti 2发1收空时编码

(1)仿真代码

%仿真Alamouti 2发1收空时编码性能,调制方式为QPSK
clear all
datasize = 100000; %仿真的符号数
EbN0 = 0:2:10; %信噪比
M = 4; %QPSK调制
x = randsrc(2,datasize/2,[0:3]); %数据源符号
x1 = pskmod(x,M,pi/4);
h = randn(2,datasize/2) +j*randn(2,datasize/2); %Rayleigh衰落信道
h = h./sqrt(2); %能量归一化

for index=1:length(EbN0)
    sigma1 = sqrt(1/(4*10.^(EbN0(index)/10))); %SISO信道高斯白噪声标准差
    n = sigma1*(randn(2,datasize/2)+j*randn(2,datasize/2));
    y = x1 + n; %通过AWGN信道
    y1 = x1 + n./h; %通过SISO瑞利衰落信道后的判决变量
    x2 = pskdemod(y,M,pi/4); 
    x3 = pskdemod(y1,M,pi/4);
    
    sigma2 = sqrt(1/(2*10.^(EbN0(index)/10))); %Alamouti方案每个子信道高斯白噪声标准差
    n = sigma2*(randn(2,datasize/2)+j*randn(2,datasize/2));
    n1(1,:) = (conj(h(1,:)).*n(1,:)+h(2,:).*conj(n(2,:)))./(sum(abs(h).^2)); %Alamouti方案的判决变量
    n1(2,:) = (conj(h(2,:)).*n(1,:)-h(1,:).*conj(n(2,:)))./(sum(abs(h).^2)); 
    y3 = x1 + n1;
    x4 = pskdemod(y3,M,pi/4);
    [temp,ber1(index)] = biterr(x,x2,log2(M));
    [temp,ber2(index)] = biterr(x,x3,log2(M));
    [temp,ber3(index)] = biterr(x,x4,log2(M));
end

semilogy(EbN0,ber1,'-ko',EbN0,ber2,'-ro',EbN0,ber3,'-go')
grid on
legend('AWGN信道','SISO瑞利衰落信道', '2发1收Alamouti方案')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')
title('2发1收Alamouti方案在瑞利衰落信道下的性能')
    

(2)仿真结果

基于Matlab的MIMO通信系统仿真_第1张图片

2.2 Alamouti 2发2收空时编码

(1)仿真代码

%仿真Alamouti 2发2收空时编码性能,调制方式为QPSK
clear all
datasize = 100000; %仿真的符号数
EbN0 = 0:2:20; %信噪比
M = 4; %QPSK调制
x = randsrc(2,datasize/2,[0:3]); %数据源符号
x1 = pskmod(x,M,pi/4);
h = randn(4,datasize/2) +j*randn(4,datasize/2); %Rayleigh衰落信道
h = h./sqrt(2); %能量归一化

for index=1:length(EbN0)
    sigma1 = sqrt(1/(4*10.^(EbN0(index)/10))); %SISO信道高斯白噪声标准差
    n = sigma1*(randn(2,datasize/2)+j*randn(2,datasize/2));
    y = x1 + n; %通过AWGN信道
    y1 = x1 + n./h(1:2,:); %通过SISO瑞利衰落信道后的判决变量
    x2 = pskdemod(y,M,pi/4); 
    x3 = pskdemod(y1,M,pi/4);
    
    sigma2 = sqrt(1/(2*10.^(EbN0(index)/10))); %Alamouti方案每个子信道高斯白噪声标准差
    n = sigma2*(randn(4,datasize/2)+j*randn(4,datasize/2));
    n1(1,:) = (conj(h(1,:)).*n(1,:)+h(2,:).*conj(n(2,:)))./(sum(abs(h(1:2,:)).^2)); %2发1收Alamouti方案判决变量的噪声项
    n1(2,:) = (conj(h(2,:)).*n(1,:)-h(1,:).*conj(n(2,:)))./(sum(abs(h(1:2,:)).^2));   
    y = x1 + n1;
    x4 = pskdemod(y,M,pi/4);
    n2(1,:) = (conj(h(1,:)).*n(1,:)+h(2,:).*conj(n(2,:))+conj(h(3,:)).*n(3,:)+h(4,:).*conj(n(4,:)))./(sum(abs(h).^2)); %2发2收Alamouti方案判决变量的噪声项
    n2(2,:) = (conj(h(2,:)).*n(1,:)-h(1,:).*conj(n(2,:))+conj(h(4,:)).*n(3,:)-h(3,:).*conj(n(4,:)))./(sum(abs(h).^2));
    y1= x1 + n2;
    x5 = pskdemod(y1,M,pi/4);
    [temp,ber1(index)] = biterr(x,x2,log2(M));
    [temp,ber2(index)] = biterr(x,x3,log2(M));
    [temp,ber3(index)] = biterr(x,x4,log2(M));
    [temp,ber4(index)] = biterr(x,x5,log2(M));
end

semilogy(EbN0,ber1,'-ko',EbN0,ber2,'-ro',EbN0,ber3,'-go',EbN0,ber4,'-bo')
grid on
legend('AWGN信道','SISO瑞利衰落信道', '2发1收Alamouti方案', '2发2收Alamouti方案')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')
title('2发2收Alamouti方案在瑞利衰落信道下的性能')

(2)仿真结果

基于Matlab的MIMO通信系统仿真_第2张图片

3. 空分复用和BLAST 结构

3.1 V-BLAST 结构

基于Matlab的MIMO通信系统仿真_第3张图片

3.2 V-BLAST 结构的迫零(ZF)检测算法

(1)仿真代码

%仿真V-BLAST结构ZF检测算法性能,调制方式为QPSK
clear all
Nt = 4; %发射天线数
Nr = 4; %接收天线数
N = 10; %每帧的长度
L = 10000; %仿真的总帧数
EbN0 = 0:2:20;
M = 4; %QPSK调制
x = randi([0,1],N*L,Nt); %信源数据
s = pskmod(x,M,pi/4); %QPSK调制

for index=1:length(EbN0)
    s1 = [];
    s2 = [];
    s3 = [];
    for index1 = 1:L
        h = randn(Nt,Nr)+j*randn(Nt,Nr); %Rayleigh衰落信道
        h = h./sqrt(2); %信道系数归一化
        [q1,r1] = qr(h'); %信道QR分解
        r = r1(1:Nt,:)'; %矩阵R
        q = q1(:,1:Nt)'; %矩阵Q
        
        sigma1 = sqrt(1/(10.^(EbN0(index)/10))); %每根接收天线的高斯白噪声标准差
        n = sigma1*(randn(N,Nr)+j*randn(N,Nr)); %每根接收天线的高斯白噪声
        
        y = s((index1-1)*N+1:index1*N,:)*h*q'+n*q'; %信号通过信道
        
        y1 = y*inv(r); %无干扰消除时的ZF检测
        s1 = [s1;pskdemod(y1,M,pi/4)];
        
        %有干扰消除时的ZF检测
        y(:,Nt) = y(:,Nt)./(r(Nt,Nt)); %检测第Nt层
        y1(:,Nt) = pskdemod(y(:,Nt),M,pi/4); %解调第Nt层
        y(:,Nt) = pskmod(y1(:,Nt),M,pi/4); %对第Nt层解调结果重新进行调制
        y2 = y;
        y3 = y1;
        for jj=Nt-1:-1:1
            for kk=jj+1:Nt
                y(:,jj) = y(:,jj)-r(kk,jj).*y(:,kk); %非理想干扰消除
                y2(:,jj) = y2(:,jj)-r(kk,jj).*s((index1-1)*N+1:index1*N,kk); %理想干扰消除
            end
            y(:,jj) = y(:,jj)./r(jj,jj);
            y2(:,jj) = y2(:,jj)./r(jj,jj); %第jj层判决变量
            y1(:,jj) = pskdemod(y(:,jj),M,pi/4); %第jj层进行解调
            y3(:,jj) = pskdemod(y2(:,jj),M,pi/4);
            y(:,jj) = pskmod(y1(:,jj),M,pi/4); %第jj解调结果重新进行调制
            y2(:,jj) = pskmod(y3(:,jj),M,pi/4);
        end
        s2 = [s2;y1];
        s3 = [s3;y3];
    end
    
    [temp,ber1(index)] = biterr(x,s1,log2(M)); %无干扰消除时的系统误码
    [temp,ber2(index)] = biterr(x,s2,log2(M)); %非理想干扰消除时的系统误码
    [temp,ber3(index)] = biterr(x,s3,log2(M)); %理想干扰消除时的系统误码
    
    [temp,ber24(index)] = biterr(x(:,1),s2(:,1),log2(M)); %非理想干扰消除时第4层的系统误码
    [temp,ber23(index)] = biterr(x(:,2),s2(:,2),log2(M)); %非理想干扰消除时第3层的系统误码
    [temp,ber22(index)] = biterr(x(:,3),s2(:,3),log2(M)); %非理想干扰消除时第2层的系统误码
    [temp,ber21(index)] = biterr(x(:,4),s2(:,4),log2(M)); %非理想干扰消除时第1层的系统误码
    
    [temp,ber34(index)] = biterr(x(:,1),s3(:,1),log2(M)); %理想干扰消除时第4层的系统误码
    [temp,ber33(index)] = biterr(x(:,2),s3(:,2),log2(M)); %理想干扰消除时第3层的系统误码
    [temp,ber32(index)] = biterr(x(:,3),s3(:,3),log2(M)); %理想干扰消除时第2层的系统误码
    [temp,ber31(index)] = biterr(x(:,4),s3(:,4),log2(M)); %理想干扰消除时第1层的系统误码
    
end

semilogy(EbN0,ber1,'-ko',EbN0,ber2,'-ro',EbN0,ber3,'-go')
title('V-BLAST结构ZF检测算法性能')
legend('无干扰消除','非理想干扰消除', '理想干扰消除')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')

figure
semilogy(EbN0,ber34,'-ko',EbN0,ber33,'-ro',EbN0,ber32,'-go',EbN0,ber31,'-bo')
title('理想干扰消除ZF检测算法性能')
legend('第1层','第2层', '第3层', '第4层')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')

figure
semilogy(EbN0,ber24,'-ko',EbN0,ber23,'-ro',EbN0,ber22,'-go',EbN0,ber21,'-bo')
title('非理想干扰消除ZF检测算法性能')
legend('第1层','第2层', '第3层', '第4层')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')

            

(2)仿真结果

基于Matlab的MIMO通信系统仿真_第4张图片

基于Matlab的MIMO通信系统仿真_第5张图片

基于Matlab的MIMO通信系统仿真_第6张图片

 

3.3 V-BLAST 结构的最小均方误差(MMSE)检测算法

(1)仿真代码

%仿真V-BLAST结构MMSE检测算法性能,调制方式为QPSK
clear all
Nt = 4; %发射天线数
Nr = 4; %接收天线数
N = 10; %每帧的长度
L = 10000; %仿真的总帧数
EbN0 = 0:2:20;
M = 4; %QPSK调制
x = randi([0,1],N*L,Nt); %信源数据
s = pskmod(x,M,pi/4); %QPSK调制

for index=1:length(EbN0)
    x1 = [];
    x2 = [];
    x3 = [];
    for index1 = 1:L
        h = randn(Nt,Nr)+j*randn(Nt,Nr); %Rayleigh衰落信道
        h = h./sqrt(2); %信道系数归一化
        
        sigma1 = sqrt(1/(10.^(EbN0(index)/10))); %每根接收天线的高斯白噪声标准差
        n = sigma1*(randn(N,Nr)+j*randn(N,Nr)); %每根接收天线的高斯白噪声
        w = h'*inv(h*h'+2*sigma1.^2*diag(ones(1,Nt))); %w的最优解
        
        y = s((index1-1)*N+1:index1*N,:)*h+n; %信号通过信道
        
        yy = y;
        y1 =  y*w; %无干扰消除时的MMSE检测
        temp1 = pskdemod(y1,M,pi/4); %无干扰消除时的解调
        x1 = [x1;temp1]; %无干扰消除时的解调结果
        
        temp2(:,Nt) = temp1(:,Nt);
        y = y-pskmod(temp2(:,Nt),4,pi/4)*h(Nt,:); %非理想干扰消除时,接收信号矩阵的更新
        
        temp3(:,Nt) = temp1(:,Nt);
        yy = yy-s((index1-1)*N+1:index1*N,Nt)*h(Nt,:); %理想干扰消除时,接收信号矩阵的更新
        
        h = h(1:Nt-1,:)
        
        for ii=Nt-1:-1:1
            w = h'*inv(h*h'++2*sigma1.^2*diag(ones(1,ii))); %信道矩阵更新后的w
            
            y1 = y*w; %非理想干扰消除的检测与解调
            temp2(:,ii)=pskdemod(y1(:,ii),M,pi/4);
            y = y-pskmod(temp2(:,ii),4,pi/4)*h(ii,:);
            
            yy1 = yy*w; %理想干扰消除的检测与解调
            temp3(:,ii)=pskdemod(yy1(:,ii),M,pi/4);
            yy = yy-s((index1-1)*N+1:index1*N,ii)*h(ii,:);
            
            h = h(1:ii-1,:);
        end
        x2 = [x2;temp2]; %非理想干扰消除时的结果
        x3 = [x3;temp3]; %理想干扰消除时的结果   
    end
    
    [temp,ber1(index)] = biterr(x,x1,log2(M)); %无干扰消除时的系统误码
    [temp,ber2(index)] = biterr(x,x2,log2(M)); %非理想干扰消除时的系统误码
    [temp,ber3(index)] = biterr(x,x3,log2(M)); %理想干扰消除时的系统误码
    
    [temp,ber24(index)] = biterr(x(:,1),x2(:,1),log2(M)); %非理想干扰消除时第4层的系统误码
    [temp,ber23(index)] = biterr(x(:,2),x2(:,2),log2(M)); %非理想干扰消除时第3层的系统误码
    [temp,ber22(index)] = biterr(x(:,3),x2(:,3),log2(M)); %非理想干扰消除时第2层的系统误码
    [temp,ber21(index)] = biterr(x(:,4),x2(:,4),log2(M)); %非理想干扰消除时第1层的系统误码
    
    [temp,ber34(index)] = biterr(x(:,1),x3(:,1),log2(M)); %理想干扰消除时第4层的系统误码
    [temp,ber33(index)] = biterr(x(:,2),x3(:,2),log2(M)); %理想干扰消除时第3层的系统误码
    [temp,ber32(index)] = biterr(x(:,3),x3(:,3),log2(M)); %理想干扰消除时第2层的系统误码
    [temp,ber31(index)] = biterr(x(:,4),x3(:,4),log2(M)); %理想干扰消除时第1层的系统误码
    
end

semilogy(EbN0,ber1,'-ko',EbN0,ber2,'-ro',EbN0,ber3,'-go')
title('V-BLAST结构MMSE检测算法性能')
legend('无干扰消除','非理想干扰消除', '理想干扰消除')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')

figure
semilogy(EbN0,ber34,'-ko',EbN0,ber33,'-ro',EbN0,ber32,'-go',EbN0,ber31,'-bo')
title('理想干扰消除MMSE检测算法性能')
legend('第1层','第2层', '第3层', '第4层')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')

figure
semilogy(EbN0,ber24,'-ko',EbN0,ber23,'-ro',EbN0,ber22,'-go',EbN0,ber21,'-bo')
title('非理想干扰消除MMSE检测算法性能')
legend('第1层','第2层', '第3层', '第4层')
xlabel('信噪比Eb/N0')
ylabel('误比特率(BER)')

            

(2)仿真结果

基于Matlab的MIMO通信系统仿真_第7张图片

基于Matlab的MIMO通信系统仿真_第8张图片

基于Matlab的MIMO通信系统仿真_第9张图片

你可能感兴趣的:(通信,mimo,数字通信,matlab)