• 大小: 0M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-05
  • 语言: 其他
  • 标签: 其他  

资源简介

Alamouti.zip

资源截图

代码片段和文件信息

function ber_ml=Alamoudi(snrsoglia);

%This function simulates a Alamouti scheme. The input variables are soglia and snr.
%Soglia: is the number of errors after which the iterations stop. For better results put high value of soglia but
%the simulation is longer.
%snr: the signal to noise ratio (if u don‘t know what is a signal to noise ratio well come back to your high school!).
%
%
%Note: U should use this function with a main function in wich u chose different value of snr. That‘s because this
%function work just with one value of snr.
%
%If u have problem with this code write me at m.allegritti@email.it.
%
%Take care!
%
%
%Max

%clc;

S_ML=zeros(14);
X_dec=zeros(12);
Nt=2;                                                          %Number of TX Antennas
Nr=2;                                                          %Number of RX Antennas
dec=zeros(12);
no_bit_sym=1;                                                  %Number of bit per symbol
no_it_x_SNR=10000;                                             %Number of iteration per simulation

iter=0;                                                        %Setting up the variables
err = 0;
tot_err_h = 0;
tot_err_ml = 0;                                                %Number of total errors

while tot_err_ml        
    iter=iter+1;                                                 %Counting the iterations
    
        for i=1:no_it_x_SNR                                                 %Starting the simulation
           
            Data=(2*round(rand(Nt1))-1)/(sqrt(Nt));                        %Creating random data
            
            %Building the Rayleigh Channel
            
            H=rey(22);
            %H=ones(22);                                                   %If u want a AWGN channel use this!
             
            sig = sqrt(0.5/(10^(snr/10)));                                  %Noise variance 
            
            n   =   sig * (randn(NrNt) + j*randn(NrNt));                    %Noise
         
            %Encoder.We code the data in an Alamouti Matrix

            X=[Data(1) -conj(Data(2)); Data(2) conj(Data(1))];              %Coded data
            
            R=H*X + n    ;                                                   %Received matrix
    
            %Combiner

            s0=conj(H(11))*R(11)+H(12)*conj(R(12))+conj(H(21))*R(21)+H(22)*conj(R(22));    %As Alamouti says 
            s1=conj(H(12))*R(11)-H(11)*conj(R(12))+conj(H(22))*R(21)-H(21)*conj(R(22));
            
            %S = kron(Rones(12^(2*no_bit_sym)));
            S=[s0 s1];
       
            
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
            %          Decoding              %
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            
                    
            dh = sqrt(2)*[1 -1]/2;
          
            %C

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        4763  2005-12-31 10:49  Alamoudi.m
     文件         624  2005-12-31 10:53  rey.m

评论

共有 条评论