www.pudn.com > Alamoudi.rar > Alamoudi.m


function ber_ml=Alamoudi(snr,soglia); 
 
%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(1,4); 
X_dec=zeros(1,2); 
Nt=2;                                                          %Number of TX Antennas 
Nr=2;                                                          %Number of RX Antennas 
dec=zeros(1,2); 
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