No BSD License  

Highlights from
Alamouti STC for MIMO System

image thumbnail

Alamouti STC for MIMO System

by

 

09 Apr 2008 (Updated )

Alamouti Space Timem Coding

AlamoutiDiversityCoding_ver2.m
% Alamouti Code to achieve diversity without channel knowledg at the
% transmitter
% It is assumed that system contains 2 transmit antennas and one receive
% antenna. At the transmitter the data of a two consecutive slots will be
% considered. At the odd time slots, the first antenna transmit
% symbol 1 (s1) and the second ones will transmit symbol 2 (s2)
% simoltaneously. At the even time slots the -s2* and s1* will be transmited
% from the first and second antenna respectively. Study "WIRELESS
% COMMUNICATIONS" by Goldsmith for further information.

% By Hamid Ramezani 01-Apr-2008

% Initialization
    clear 
    clc
    
% Setting parameters
    numOfBlk = 1e6;     % number of blocks of data to be transmitted
    qamOrder = 16;      % the QAM modulation order 4,16,64
    SNRdB    = 6:1:30;

    linColor = 'b'; % graph color   'b','r','k',... see the help of plot function
    linSym   = 'o'; % graph Symbol  'o','>','<',... see the help of plotf unction
    
% Memory allocation
errRate = zeros(size(SNRdB));

%% AlamoutiSpace Time Code
for i = 1 : length(SNRdB)
% Main Program
    % generating the data
    txData = randint(numOfBlk*2,1,qamOrder);
    
    % splitting the data into two vectors (first transmition, second
    % transmition in time);
    temp = reshape(txData,numOfBlk,2);

    % QAM Modulation of transmite data
    temp = qammod(temp,qamOrder);
        
    % 2 transmite antenna and 1 receive antena channel gain, the channel
    % varinance is set to unity and a rayleigh flat fading channel in each
    % path is assumed
    H  = 1/sqrt(2) * (randn(numOfBlk,2) + sqrt(-1)*randn(numOfBlk,2));
    
    % transmitted data through channel
    % in each transmite antenna half of the power will be sent
    % 1/sqrt(2) is to represent the half of the power on each antenna
    txMod(:,1) =  H(:,1).* 1/sqrt(2).*temp(:,1)     + H(:,2).* 1/sqrt(2).*temp(:,2)     ;
    txMod(:,2) = -H(:,1).*(1/sqrt(2).*temp(:,2)').' + H(:,2).*(1/sqrt(2).*temp(:,1)').' ;
    
    % adding noise 
    txMod = awgn(txMod,SNRdB(i),'measured');
    
    % receiving the data
    % sqrt(2) is used for normalization
    temp(:,1) = sqrt(2)*(H(:,1)'.' .* txMod(:,1) + H(:,2) .* txMod(:,2)'.')./(abs(H(:,1)).^2 + abs(H(:,2)).^2);
    temp(:,2) = sqrt(2)*(H(:,2)'.' .* txMod(:,1) - H(:,1) .* txMod(:,2)'.')./(abs(H(:,1)).^2 + abs(H(:,2)).^2);
    
    rxData(:,1) = qamdemod(temp(:,1),qamOrder);
    rxData(:,2) = qamdemod(temp(:,2),qamOrder);
    
    [numErr errRate(i)] = symerr(rxData,reshape(txData,numOfBlk,2));
end

% graphical observation
    f1 = figure(1);
    semilogy(SNRdB,errRate,[linColor,'-',linSym]);
    xlabel('SNR in dB');
    ylabel('Symbol Error Rate');
    
%% No space time coding
for i = 1 : length(SNRdB)
    % txData is set in the Alamouti Code
    temp = qammod(txData,qamOrder);
    
    % Channel Definition
    H  = 1/sqrt(2) * (randn(numOfBlk*2,1) + sqrt(-1)*randn(numOfBlk*2,1));
    
    % passing through channel
    txMod = H.*temp;
    
    % adding noise
    txMod = awgn(txMod,SNRdB(i),'measured');
    
    % decoding
    temp = txMod./H;
    rxData = qamdemod(temp,qamOrder);
    
    [numErr errRate(i)] = symerr(rxData,txData);
end

% graphical observation
    figure(1);
    hold on
    semilogy(SNRdB,errRate,[linColor,':',linSym]);
    xlabel('SNR in dB');
    ylabel('Symbol Error Rate');
    title(['SER evaluation of ', num2str(qamOrder),'QAM Modulation based on Alamouti STC'])
    legend('With Alamouti Code 2x1 chann','No STC 1x1 chann')
    grid on
    

Contact us