Simulation of Hierarchical Space-Time Code for MIMO System Based on MATLAB

Here, we adopt a 2*2 MIMO system, and according to the above theory, we start to design a simple MIMO system.

    First, define the transmitting antenna and the receiving antenna. Here, according to the requirements of the project, both are set to 2. Of course, the system can be set to the number we need according to the actual needs. We will make a simple comparison of the systems with different antenna numbers.

   

Here, according to the previous theoretical analysis, we process the channel theory to obtain a simple channel model whose expression is shown in the above code.

Do serial and parallel processing of the current signal, and put the processed signal into the sMatrix0 matrix. This step is relatively simple, so I won't introduce it here.

Here, the signal is BPSK modulated, and then a Gaussian white noise is used to simulate the channel. Through the above steps, we have basically completed the design of the transmission module of the MIMO system.

At the receiving end, we mainly do the inverse operation processing of the system, that is, PSK demodulation and parallel-serial conversion. Such a simple 2*2MIMO system is completed. Below we will do a simple simulation analysis of the system.

Figure 3-1 2*2MIMO system performance simulation

Figure 3-2 Performance comparison of MIMO systems with different numbers of antennas

    As shown in the figure above, from top to bottom are the performance curves of 8*8 MIMO system, 4*4 MIMO system and 2*2 MIMO system. By comparison, the more the number of antennas, the better the performance of the MIMO system. Of course, in practice, we use more 8*8 MIMO systems to obtain higher-performance communication quality.

Part of the core code:

clc;
clear;

O=[1 -2 -3;2+j 1+j 0;3+j 0 1+j;0 -3+j 2+j];                         
Nt=2; % number of transmitting antennas         
Nr=2; % receiving Number of antennas

timer=4;                                                 
                                                           
Number_bit=1000; %Number of sent symbols                                                    
mod=4;         

min_snr=3; % minimum SNR                                                   
max_snr=15; % maximum SNR

num_X=1;
num_bit_per_sym=log2(mod);% all bits per symbol

for cc_ro=1:timer
    for cc_co=1:Nt
        num_X=max(num_X,abs(real(O(cc_ro,cc_co))));
    end
end

co_x=zeros(num_X,1);
for con_ro=1:timer                                                
    for con_co=1:Nt
        if abs(real(O(con_ro,con_co)))~=0
            delta(con_ro,abs(real(O(con_ro,con_co))))=sign(real(O(con_ro,con_co)));
            epsilon(con_ro,abs(real(O(con_ro,con_co))))=con_co;
            co_x(abs(real(O(con_ro,con_co))),1)=co_x(abs(real(O(con_ro,con_co))),1)+1;
            eta(abs(real(O(con_ro,con_co))),co_x(abs(real(O(con_ro,con_co))),1))=con_ro;
            coj_mt(con_ro,abs(real(O(con_ro,con_co))))=imag(O(con_ro,con_co));
        end
    end
end

eta=eta.';                                                           
eta=sort(eta);
eta=eta.';
for SNR=min_snr:max_snr                                              
    clc
    disp('Wait until SNR=');disp(max_snr);
    SNR
    n_err_sym=0;
    n_err_bit=0;
    graph_inf_sym(SNR-min_snr+1,1)=SNR;
    graph_inf_bit(SNR-min_snr+1,1)=SNR;
    for con_sym=1:Number_bit
        bi_data=randint(num_X,num_bit_per_sym);                     
        de_data=bi2de(bi_data);                                     
        data=pskmod(de_data,mod,0,'gray');
        H=randn(Nt,Nr)+j*randn(Nt,Nr);                             
        XX=zeros(timer,Nt);
        for con_r=1:timer                                          
            for con_c=1:Nt
                if abs(real(O(con_r,con_c)))~=0
                    if imag(O(con_r,con_c))==0
                        XX(con_r,con_c)=data(abs(real(O(con_r,con_c))),1)*sign(real(O(con_r,con_c)));
                    else
                        XX(con_r,con_c)=conj(data(abs(real(O(con_r,con_c))),1))*sign(real(O(con_r,con_c)));
                    end
                end
            end
        end   
        
        
        H=H.';
        XX=XX.';
        snr=10^(SNR/10);
        Noise=(randn(Nr,timer)+j*randn(Nr,timer));               
        Y = (sqrt (snr/Nt)*H*XX+Noise). ';                              
        H = H. ';                                                      
        for co_ii = 1: num_X
            for co_tt = 1: size (eta, 2)
                if eta (co_ii, co_tt) ~ = 0
                    if coj_mt (eta (co_ii, co_tt), co_ii) == 0
                        r_til (eta (co_ii, co_tt) ,:, co_ii) = Y (and (co_ii, co_tt), :);
                        a_til (eta (co_ii, co_tt),:, co_ii) = conj (H (epsilon (eta (co_ii, co_tt), co_ii), :));
                    else r_til
                        (eta (co_ii, co_tt),:, co_ii) = conj (Y (eta (co_ii, co_tt), :));
                        a_til (eta (co_ii, co_tt),:, co_ii) = H (epsilon (eta (co_ii, co_tt), co_ii), :);
                    end
                end
            end
        end
        RR=zeros(num_X,1);
        for ii=1:num_X                                               
            for tt=1:size(eta,2)
                for jj=1:Nr
                    if eta(ii,tt)~=0
                        RR(ii,1)=RR(ii,1)+r_til(eta(ii,tt),jj,ii)*a_til(eta(ii,tt),jj,ii)*delta(eta(ii,tt),ii);
                    end
                end
            end
        end
        re_met_sym=pskdemod(RR,mod,0,'gray');                     
        re_met_bit=de2bi(re_met_sym);
        re_met_bit(1,num_bit_per_sym+1)=0;                          
        for con_dec_ro=1:num_X                                             
            if re_met_sym(con_dec_ro,1)~=de_data(con_dec_ro,1)
                n_err_sym=n_err_sym+1;
                for con_dec_co=1:num_bit_per_sym
                    if re_met_bit(con_dec_ro,con_dec_co)~=bi_data(con_dec_ro,con_dec_co)
                        n_err_bit=n_err_bit+1;
                    end
                end
            end
        end
    end
    Perr_sym=n_err_sym/(num_X*Number_bit);                                 
    graph_inf_sym(SNR-min_snr+1,2)=Perr_sym;
    Perr_bit=n_err_bit/(num_X*Number_bit*num_bit_per_sym);
    graph_inf_bit(SNR-min_snr+1,2)=Perr_bit;
end
x_sym=graph_inf_sym(:,1);                                          
y_sym=graph_inf_sym(:,2);
subplot(211);
semilogy(x_sym,y_sym,'r-*');

x_bit=graph_inf_bit(:,1);
y_bit=graph_inf_bit(:,2);
subplot(212);
semilogy(x_bit,y_bit,'b-*');


 

A01-05

Guess you like

Origin blog.csdn.net/ccsss22/article/details/123381460#comments_20967810