Alamouti STBC

In the recent past, we have discussed three receive diversity schemes – Selection combining, Equal Gain Combining and Maximal Ratio Combining. All the three approaches used the antenna array at the receiver to improve the demodulation performance, albeit with different levels of complexity. Time to move on to a transmit diversity scheme where the information is spread across multiple antennas at the transmitter. In this post, lets discuss a popular transmit diversity scheme called Alamouti Space Time Block Coding (STBC). For the discussion, we will assume that the channel is a flat fading Rayleigh multipath channel and the modulation is BPSK.

Alamouti STBC

A simple Space Time Code, suggested by Mr. Siavash M Alamouti in his landmark October 1998 paper – A Simple Transmit Diversity Technique for Wireless Communication, offers a simple method for achieving spatial diversity with two transmit antennas. The scheme is as follows:

1. Consider that we have a transmission sequence, for example

2. In normal transmission, we will be sending in the first time slot, in the second time slot, and so on.

3. However, Alamouti suggested that we group the symbols into groups of two. In the first time slot, send and from the first and second antenna. In second time slot send and from the first and second antenna. In the third time slot send and from the first and second antenna.In fourth time slot, send and from the first and second antenna and so on.

4. Notice that though we are grouping two symbols, we still need two time slots to send two symbols. Hence, there is no change in the data rate.

5. This forms the simple explanation of the transmission scheme with Alamouti Space Time Block coding.

Figure: 2-Transmit, 1-Receive Alamouti STBC coding

Other Assumptions

1. The channel is flat fading – In simple terms, it means that the multipath channel has only one tap. So, the convolution operation reduces to a simple multiplication. For a more rigorous discussion on flat fading and frequency selective fading, may I urge you to review Chapter 15.3 Signal Time-Spreading from [DIGITAL COMMUNICATIONS: SKLAR]

2. The channel experience by each transmit antenna is independent from the channel experienced by other transmit antennas.

3. For the transmit antenna, each transmitted symbol gets multiplied by a randomly varying complex number . As the channel under consideration is a Rayleigh channel, the real and imaginary parts of are Gaussian distributed having mean and variance .

4. The channel experienced between each transmit to the receive antenna is randomly varying in time. However, the channel is assumed to remain constant over two time slots.

5. On the receive antenna, the noise has the Gaussian probability density function with

with and .

7. The channel is known at the receiver.

Receiver with Alamouti STBC

In the first time slot, the received signal is,

.

In the second time slot, the received signal is,

.

where

, is the received symbol on the first and second time slot respectively,
is the channel from transmit antenna to receive antenna,
is the channel from transmit antenna to receive antenna,
, are the transmitted symbols and
is the noise on time slots.

Since the two noise terms are independent and identically distributed,

.

For convenience, the above equation can be represented in matrix notation as follows:

.

Let us define . To solve for , we know that we need to find the inverse of .

We know, for a general m x n matrix, the pseudo inverse is defined as,

.

The term,

. Since this is a digonal matrix, the inverse is just the inverse of the diagonal elements, i.e

.

The estimate of the transmitted symbol is,

.

If you compare the above equation with the estimated symbol following equalization in Maximal Ratio Combining, you can see that the equations are identical.

BER with Almouti STBC

Since the estimate of the transmitted symbol with the Alamouti STBC scheme is identical to that obtained from MRC, the BER with above described Alamouti scheme should be same as that for MRC. However, there is a small catch.

With Alamouti STBC, we are transmitting from two antenna’s. Hence the total transmit power in the Alamouti scheme is twice that of that used in MRC. To make the comparison fair, we need to make the total trannsmit power from two antennas in STBC case to be equal to that of power transmitted from a single antenna in the MRC case. With this scaling, we can see that BER performance of 2Tx, 1Rx Alamouti STBC case has a roughly 3dB poorer performance that 1Tx, 2Rx MRC case.

From the post on Maximal Ratio Combining, the bit error rate for BPSK modulation in Rayleigh channel with 1 transmit, 2 receive case is,

, where

.

With Alamouti 2 transmit antenna, 1 receive antenna STBC case,

and Bit Error Rate is

.

Key points

The fact that is a diagonal matrix ensured the following:
1. There is no cross talk between , after the equalizer.

2. The noise term is still white.

.

Simulation Model

The Matlab/Octave script performs the following

(a) Generate random binary sequence of +1’s and -1’s.

(b) Group them into pair of two symbols

(c) Code it per the Alamouti Space Time code, multiply the symbols with the channel and then add white Gaussian noise.

(d) Equalize the received symbols

(e) Perform hard decision decoding and count the bit errors

(f) Repeat for multiple values of and plot the simulation and theoretical results.

Click here to download Matlab/Octave script for simulating BER for 2 transmit, 1 receive Alamouti STBC coding for BPSK modulation in Rayleigh fading channel

Figure: BER plot for BPSK in Rayleigh channel with 2 Transmit and 1 Receive Alamouti STBC

Observations

Compared to the BER plot for nTx=1, nRx=2 Maximal ratio combining, we can see the Alamouti Space Time Block Coding has around 3dB poorer performance.

Reference

[DIG-COMM-BARRY-LEE-MESSERSCHMITT] Digital Communication: Third Edition, by John R. Barry, Edward A. Lee, David G. Messerschmitt

A Simple Transmit Diversity Technique for Wireless Communication Siavash M Alamouti, IEEE Journal on selected areas in Communication, Vol 16, No, 8, October 1998

273 thoughts on “Alamouti STBC

  1. Mr. Krishna, your posts have been very helpful for me… thank you so much..
    I am trying to implement alamouti scheme on optical transmission simply by changing the random channel h(2,N) but I keep getting 50% BER when changing h …. any Idea why ?

    1. I can’t understand why you made the line:
      hMod = kron(reshape(h,2,N/2),ones(1,2)); % repeating the same channel for two symbols
      can’t we just create two random channels? or is this affecting the hEq Matrix ?

  2. i want matlab code for vblast spatial multiplexing. i have qpsk modulated turbo code and want to pass it to vblast spatial multiplexing.
    could anyone help me??

  3. i am working on the video transmission project..but um geeting an error in dis…i hope you can figure it out..
    function mpegproj
    % MPEG-2 style coding. This function will get a movie, encode
    % it, decode it, and write the MPEG data and both movie versions to disk
    % for later playback.

    fprintf(‘\nMPEG Project\n’)

    nf = 10; % Number of frames to process, 0 = process entire movie

    fprintf(‘%i frames\n’,nf)

    mov = getmov(nf);

    tic
    mpeg = encmov(mov);
    fprintf(‘Encode time: %s\n’,sec2timestr(toc))

    tic
    mov2 = decmpeg(mpeg);
    fprintf(‘Decode time: %s\n’,sec2timestr(toc))

    save lastmov mov mpeg mov2

    %%
    function movdata = getmov(nf)
    % Choose the movie to process. Each movie must be saved to disk in a .mat
    % file. The .mat file should contain a variable named ‘mov’ that is a
    % MATLAB movie.
    %
    % See loadFileYuv and loadFileY4m for help converting movies from YUV and
    % Y4M format to MATLAB movies.

    % Movie files & number of frames
    %
    % bus 150
    % carphone 382
    % tempete2 260
    % husky 250
    % akiyo 300 @ 60 fps
    % foreman 300
    % hall_monitor 300 @ 60 fps
    % mobile 300 @ 60 fps

    load bus
    % load carphone
    % load tempete2
    % load mobile
    % load hall_monitor
    % load husky

    % Movie is RGB, so get 4-D array (height, width, color component, frame #)
    if nf == 0
    nf = length(mov);
    end
    movdata = repmat(uint8(0),[size(mov(1).cdata), nf]);
    for i = 1:nf
    movdata(:,:,:,i) = mov(i).cdata;
    end

    %%
    function mpeg = encmov(mov)

    % Frame type pattern (repeats for entire movie)
    fpat = ‘IPPPP’; % Custom
    % fpat = ‘I’; % All I frames
    % fpat = [‘I’, repmat(‘P’,1,size(mov,4))]; % All P frames (except #1)

    % Loop over frames
    k = 0;
    pf = [];
    progressbar
    for i = 1:size(mov,4)

    % Get frame
    f = double(mov(:,:,:,i));

    % Convert frame to YCrCb
    f = rgb2ycc(f);

    % Get frame type
    k = k + 1;
    if k > length(fpat)
    k = 1;
    end
    ftype = fpat(k);

    % Encode frame
    [mpeg{i},pf] = encframe(f,ftype,pf);

    progressbar(i/(2*size(mov,4)))

    end

    %%
    function [mpeg,df] = encframe(f,ftype,pf)

    [M,N,i] = size(f);
    mbsize = [M, N] / 16;
    mpeg = struct(‘type’,[],’mvx’,[],’mvy’,[],’scale’,[],’coef’,[]);
    mpeg(mbsize(1),mbsize(2)).type = [];

    % Loop over macroblocks
    pfy = pf(:,:,1);
    df = zeros(size(f));
    for m = 1:mbsize(1)
    for n = 1:mbsize(2)

    % Encode one macroblock
    x = 16*(m-1)+1 : 16*(m-1)+16;
    y = 16*(n-1)+1 : 16*(n-1)+16;
    [mpeg(m,n),df(x,y,:)] = encmacroblock(f(x,y,:),ftype,pf,pfy,x,y);

    end % macroblock loop
    end % macroblock loop

    %%
    function b = getblocks(mb)

    b = zeros([8, 8, 6]);

    % Four lum blocks
    b(:,:,1) = mb( 1:8, 1:8, 1);
    b(:,:,2) = mb( 1:8, 9:16, 1);
    b(:,:,3) = mb( 9:16, 1:8, 1);
    b(:,:,4) = mb( 9:16, 9:16, 1);

    % Two subsampled chrom blocks (mean of four neighbors)
    b(:,:,5) = 0.25 * ( mb(1:2:15,1:2:15, 2) + mb(1:2:15,2:2:16, 2) …
    + mb(2:2:16,1:2:15, 2) + mb(2:2:16,2:2:16, 2) );
    b(:,:,6) = 0.25 * ( mb(1:2:15,1:2:15, 3) + mb(1:2:15,2:2:16, 3) …
    + mb(2:2:16,1:2:15, 3) + mb(2:2:16,2:2:16, 3) );

    %%
    function ycc = rgb2ycc(rgb)

    % Transformation matrix
    m = [ 0.299 0.587 0.144;
    -0.168736 -0.331264 0.5;
    0.5 -0.418688 -0.081312];

    % Get movie data
    [nr,nc,c] = size(rgb);

    % Reshape for matrix multiply
    rgb = reshape(rgb,nr*nc,3);

    % Transform color coding
    ycc = m * rgb’;
    ycc = ycc + repmat([0; 0.5; 0.5],1,nr*nc);

    % Reshape to original size
    ycc = reshape(ycc’,nr,nc,3);

    %%
    function [mpeg,dmb] = encmacroblock(mb,ftype,pf,pfy,x,y)

    % Coeff quantization matrices
    persistent q1 q2
    if isempty(q1)
    q1 = qintra;
    q2 = qinter;
    end

    % Quality scaling
    scale = 31;

    % Init mpeg struct
    mpeg.type = ‘I’;
    mpeg.mvx = 0;
    mpeg.mvy = 0;

    % Find motion vectors
    if ftype == ‘P’
    mpeg.type = ‘P’;
    [mpeg,emb] = getmotionvec(mpeg,mb,pf,pfy,x,y);
    mb = emb; % Set macroblock to error for encoding
    q = q2;
    else
    q = q1;
    end

    % Get lum and chrom blocks
    b = getblocks(mb);

    % Encode blocks
    for i = 6:-1:1
    mpeg.scale(i) = scale;
    coef = dct2(b(:,:,i));
    mpeg.coef(:,:,i) = round( 8 * coef ./ (scale * q) );
    end

    % Decode this macroblock for reference by a future P frame
    dmb = decmacroblock(mpeg,pf,x,y);

    %%
    function [mpeg,emb] = getmotionvec(mpeg,mb,pf,pfy,x,y)

    % Do search in Y only
    mby = mb(:,:,1);
    [M,N] = size(pfy);

    % % Exhaustive search
    % maxstep = 10; % Largest allowable motion vector in x and y
    %
    % mvxv = -maxstep:maxstep;
    % mvyv = -maxstep:maxstep;
    % minsad = inf;
    % for i = 1:length(mvxv)
    %
    % tx = x + mvxv(i);
    % if (tx(1) < 1) | (M < tx(end))
    % continue
    % end
    %
    % for j = 1:length(mvyv)
    %
    % ty = y + mvyv(j);
    % if (ty(1) < 1) | (N < ty(end))
    % continue
    % end
    %
    % sad = sum(sum(abs(mby-pfy(tx,ty))));
    %
    % if sad = 1

    minsad = inf;
    for i = 1:length(dx)

    tx = x + mvx + dx(i)*step;
    if (tx(1) < 1) || (M < tx(end))
    continue
    end

    ty = y + mvy + dy(i)*step;
    if (ty(1) < 1) || (N < ty(end))
    continue
    end

    sad = sum(sum(abs(mby-pfy(tx,ty))));

    if sad < minsad
    ii = i;
    minsad = sad;
    end

    end

    mvx = mvx + dx(ii)*step;
    mvy = mvy + dy(ii)*step;

    step = step / 2;

    end

    mpeg.mvx = mvx; % Store motion vectors
    mpeg.mvy = mvy;

    emb = mb – pf(x+mvx,y+mvy,:); % Error macroblock

    %%
    function mov = decmpeg(mpeg)

    movsize = size(mpeg{1});
    mov = repmat(uint8(0),[16*movsize(1:2), 3, length(mpeg)]);

    % Loop over frames
    pf = [];
    for i = 1:length(mpeg)

    % Decode frame
    f = decframe(mpeg{i},pf);

    % Cache previous frame
    pf = f;

    % Convert frame to RGB
    f = ycc2rgb(f);

    % Make sure movie is in 8 bit range
    f = min( max(f,0), 255);

    % Store frame
    mov(:,:,:,i) = uint8(f);

    progressbar((i+length(mpeg))/(2*length(mpeg)))

    end

    %%
    function fr = decframe(mpeg,pf)

    mbsize = size(mpeg);
    M = 16 * mbsize(1);
    N = 16 * mbsize(2);

    % Loop over macroblocks
    fr = zeros(M,N,3);
    for m = 1:mbsize(1)
    for n = 1:mbsize(2)

    % Construct frame
    x = 16*(m-1)+1 : 16*(m-1)+16;
    y = 16*(n-1)+1 : 16*(n-1)+16;
    fr(x,y,:) = decmacroblock(mpeg(m,n),pf,x,y);

    end % macroblock loop
    end % macroblock loop

    %%
    function mb = putblocks(b)

    mb = zeros([16, 16, 3]);

    % Four lum blocks
    mb( 1:8, 1:8, 1) = b(:,:,1);
    mb( 1:8, 9:16, 1) = b(:,:,2);
    mb( 9:16, 1:8, 1) = b(:,:,3);
    mb( 9:16, 9:16, 1) = b(:,:,4);

    % Two subsampled chrom blocks
    z = [1 1; 1 1];
    mb(:,:,2) = kron(b(:,:,5),z);
    mb(:,:,3) = kron(b(:,:,6),z);

    %%
    function rgb = ycc2rgb(ycc)

    % Transformation matrix
    m = [ 0.299 0.587 0.144;
    -0.168736 -0.331264 0.5;
    0.5 -0.418688 -0.081312];
    m = inv(m);

    % Get movie data
    [nr,nc,c] = size(ycc);

    % Reshape for matrix multiply
    ycc = reshape(ycc,nr*nc,3);

    % Transform color coding
    rgb = ycc – repmat([0, 0.5, 0.5],nr*nc,1);
    rgb = m * rgb';

    % Reshape to original size
    rgb = reshape(rgb',nr,nc,3);

    %%
    function mb = decmacroblock(mpeg,pf,x,y)

    % Coeff quantization matrices
    persistent q1 q2
    if isempty(q1)
    q1 = qintra;
    q2 = qinter;
    end

    mb = zeros(16,16,3);

    % Predict with motion vectors
    if mpeg.type == 'P'
    mb = pf(x+mpeg.mvx,y+mpeg.mvy,:);
    q = q2;
    else
    q = q1;
    end

    % Decode blocks
    for i = 6:-1:1
    coef = mpeg.coef(:,:,i) .* (mpeg.scale(i) * q) / 8;
    b(:,:,i) = idct2(coef);
    end

    % Construct macroblock
    mb = mb + putblocks(b);

    %%
    function q = qinter
    % Quantization table for P or B frames

    % q = repmat(16,8,8);
    q = 16;

    %%
    function q = qintra
    % Quantization table for I frames

    q = [ 8 16 19 22 26 27 29 34;
    16 16 22 24 27 29 34 37;
    19 22 26 27 29 34 34 38;
    22 22 26 27 29 34 37 40;
    22 26 27 29 32 35 40 48;
    26 27 29 32 35 40 48 58;
    26 27 29 34 38 46 56 69;
    27 29 35 38 46 56 69 83 ];

    %%
    function y = dct2(x)
    % Perform 2-D DCT

    % Use dctmtx to compute IDCT faster
    persistent d
    if isempty(d)
    d = dctmtx(8);
    end

    y = d * x * d';

    % % DCT is seperable so compute on columns, then on rows
    % y = dct(x); % Columns
    % y = dct(y')'; % Rows

    %%
    function y = idct2(x)
    % Perform 2-D IDCT

    % Use dctmtx to compute IDCT faster
    persistent d
    if isempty(d)
    d = dctmtx(8);
    end

    y = d' * x * d;

    % % DCT is seperable so compute on columns, then on rows
    % y = idct(x); % Columns
    % y = idct(y')'; % Rows

    and the error is….
    ??? Undefined function or method 'main' for input arguments of type 'char'.

  4. hello sir….
    i need your help regarding my project…
    actually i need a mtalab code for video transmission through MIMO…
    plzz send me the code as soon as possible…
    thnkkzz in advance…

  5. sir i am doing project in mimo….
    your coding is more help ful for me…….thanks lot sir……
    but i didnt get clear some statement in that coding….

    1. sCode = zeros(2,N);

    2. yMod = kron(reshape(y,2,N/2),ones(1,2)); % [y1 y1 … ; y2 y2 …]
    yMod(2,:) = conj(yMod(2,:)); % [y1 y1 … ; y2* y2*…]

    3. ipHat = real(yHat)>0;
    can you explain……pls pls
    if i want to do 3×3 …. in which coding i want to modify…….
    thanks you sir

  6. Hello, Krishna!

    Did you explore in your develops these blocks for Alamouti STBC system: “Signal Space Rotation” and “Constellation Interleaver”?

  7. hello ,sir
    In stbc 2×1 system
    antenna 1 and antenna 2 same time transmit data so its frequency same ya different
    possible different frequency so no interfere each other signal thats true?

  8. sir i am working in stbc mimo coding use jakes channel model you have idea about doppler frequency spread and doppler spetrum?

  9. sir to requared orthogonal x1* and x2* are use
    but( -)negative sign for -x2* why they use any idea sir?

    1. @piyush: hmm…

      octave:2> h1 =[-0.070454 + 1.751452i]
      octave:3> h2 =[7.8808e-04 – 9.2101e-01i]
      octave:4> m = [h1 h2; conj(h2) -conj(h1)]
      octave:5> m’*m
      ans =

      3.92081 + 0.00000i 0.00000 + 0.00000i
      0.00000 + 0.00000i 3.92081 – 0.00000i

      with out the -ve sign, cannot get the diagonal terms to 0.

      try playing with different combinations of h1 and h2.

  10. which IEEE standard use stbc ?

    STBC is wireless comm. so which layer they work?
    MAC or PHY for wireless comm that true sir?

      1. possible same information means x1,x2 use audio otherwise x1,x2 use video so interference
        another ques. they use x1 audio and x2 use video in stbc alamoutis ?
        sir this type information available on any book name ya website link pleeeeeeeeeeee

  11. why use -x2* not use for -x1* in STBC 2×1 antenna pattern

    thanks for krishana sankar sir for good detail answer i am first time use this site ,this is really helpfull

  12. Dear Krishna,
    Very nice work. I would like to use some pulse instead of rectangular pulse you use. Do you have idea how to do that?
    regards

  13. please
    I want matlab code about alamouti with perfect channel estimation at the receiver

  14. Dear Krishna,

    Thanks a lot for all your Matlab codes and valuable materials. It has always helped me.
    My question is for the case of 2Tx, 1Rx using Alamouti STBC.

    the power of each transmit antenna has to be halved in order to keep the total transmit power from 2 antennas equal to the total transmit power from 1 antenna.

    For this purpose, we have to divide the power of each transmit antenna by 2, right?

    I was not able to find where you divided the power of each transmit antenna by 2 in order to compensate for the fairness.

    I appreciate if you could let me know.
    Thanks alot

    1. @Ali: The power is 1/2 or alternatively, the voltage is 1/sqrt(2). The scaling by 1/sqrt(2) happens in the code snippet below

      % Alamouti STBC
      sCode = zeros(2,N);
      sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 …]
      sCode(:,2:2:end) = (1/sqrt(2))*(kron(ones(1,N/2),[-1;1]).*flipud(reshape(conj(s),2,N/2))); % [-x2* x1* ….]

  15. hello sir ,
    i want help in ostbc. u have a code of ostbc for bpsk in rayleigh fading channel .
    but i need the same code for nakagami channel . the BER of ostbc for bpsk in nakagami -m fading channel.
    sir plz help . i already commented you many times before.
    so plz help me.

  16. hello Mr. Krishna Sankar

    the BER performance of 2X1 (alamouti ) is superior the 3X1 (stbc), is this true ??
    many research show this result.
    thank you

  17. Hello sir,
    Why should we use x2* and -x1* in the second time slot. Can’t we use any other symbol like x2 and -x1 etc.

    Thanks in advance.

    1. @Venkatraman: The objective is to ensure that there is no interference between x1 and x2. Let’s say, we do not use conj(), the imaginary arm of the offdiagonal term will be non-zero’s
      >> clear all
      >> randn(‘seed’,0)
      >> h1 = randn + j*randn % (= -2.1539 – 1.6868i)
      >> h2 = randn + j*randn % (= -0.33652 + 0.90372i))
      >> H1 = [h1 h2; h2 -h1] % with no conjugate
      >> H2 = [h1 h2; h2′ -h1′] % with conjugate
      >> H1’*H1 = [8.41421 – 0.00000i 0.00000 – 5.02824i
      0.00000 + 5.02824i 8.41421 – 0.00000i] % in the off-diagonal, can see that imaginary arm is non-zero
      >> H2’*H2 = [8.41421 + 0.00000i 0.00000 + 0.00000i
      0.00000 + 0.00000i 8.41421 – 0.00000i] % in the off-diagonal, both real and imaginary arms are zero’s

  18. hello Mr. Krishna Sankar

    when i scale the signal by the factor 1/sqrt(nTx), then the ber increase with increase the number of antenna?
    note: i use stbc with mimo-ofdm in awgn channel, sucha that the received signal
    r=H(s+n),,, is this true

  19. Hi Krishna Sankar.
    First I would like thank you for all your simulation.
    Can you send me articles on the application Alamouti OFDM system is not?

  20. hello,

    excuse me i have a question about mimo stbc.
    if i have more than two transmitt antenna ( 3,4 …etc) how i can normlize the transmitted power.
    is this by number of transmit antenna, but this not true because the ber is increase with increasing number of transmit antenna.
    thank you

      1. thank you Dear Krishna Sankar for reception,

        is the ber increase by increase the transmit antenna at fixed number of receive antenna, i mean : if we move from 3X1 to 4X1 and so on the ber increase

        thank you

  21. Dear Sir
    you have written the equation of BER for 2-T and 1-R antenna as follows
    pAlamouti = 1/2 – 1/2*(1+2./EbN0Lin).^(-1/2);
    theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));

    But what will be the equation for 2-T and 2-R antenna and 4-T and 4-R. Please give me the equation with short explanation.

  22. hi krishna sir,
    i compared simulation results of 2 x 2 stc MIMO with QPSK and 4-QAM modulation, i am getting better BER performance in 4-QAM than QPSK. is it true?

  23. Can u kindly mail me the full program code for “interference cancellation and detection for more than two users” by Feng Li and Hamid Jafarkhani.

  24. hi krishna sir,
    i m doing project in MIMO detection using QRD-M algorithm. can i get matlab code for this using QAM modulation?

  25. hi everyone !
    I am studying about space time coding STBC in SISO system. I have to simulate in matlab 1 system one tranmisster and one receiver with fading rayleigh.
    I tried my best but i can not simulate. Who can help me. Please !!

    1. @kelvin: The classical STBC coding intents to use more than one transmit antenna to get the diversity gain. Can you please point to your reference which tries to use STBC with one transmit antenna

  26. Dear Krishna Sankar

    I’m a graduate student at a university in Turkey and I’m studying ofdm and Alamouti STBC. I can perform OFDM and Alamouti stbc matlab simulation separately. But I can’t combine thats.

    consequently, I need some help, can you help me please….

  27. Hi Krishna,
    How did you have theory form of BER of Alamouti: Pe,STBC=p_STBC^2[1+2(1-p_STBC)]? Why MIMO STBC 2×2 haven’t theory form?
    Thank you,

  28. hi , I would like to adapt the code for ofdm ,but it didnt work with the right performance with ALMOUTI,,,so do you have any suggestions ?

  29. i would like to know if there is a code for implementing diversity with OFDM
    please reply me as soon as possible ,,as all of your diversity codes didnt work with OFDM

  30. hi man ,
    the output you get from this simulation is different from the output of the paper
    in the simulation you got the output of 1Tx and 4Rx NOT for 2Tx and 1Rx

    look forward to hear from u
    regards ,

      1. i meant that if you take a look at the paper you will find that for 2TX and 1RX the bit error rate is start at 10^-2 and E\N is around 13
        but in the simulation for 2TX and 1RX the bit error start at 10^-1 and the E\N around 24
        is this has any effect ?
        and you can get the same output in the paper by make some changes in the general formula at the end of simulation and use this formula

        pAlamouti = 1/8 – 1/8*(1+2./EbN0Lin).^(-1/2);

        theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));
        instead of the original one

        1. @abdallah: Well, I compared our simulations with the original paper:
          In our simulation, the 10^-2 is around 13dB, 10^-3 is around 14dB, 10^-4 is around 19dB
          In the paper too, the 10^-2 is around 13dB, 10^-3 is around 14dB, 10^-4 is around 19dB
          Not sure where you are seeing the difference?

  31. hi man ,
    the output of the simulation is different from the output in the paper
    in your simulation u got the output of 1Tx and 4 Rx NOT for 2Tx and 1RX
    look forward to hear from you man,

    regards

  32. I had a problem with the detection of the symbols, i had a lot of errors, but i fix its, plaz if you can help me to introduce interference, i cannot find the formula for that..

    I have already simulate alamoyti 2×1 and now i want to go further, i want to introduce interference and my channel become Y=Hs+n+I, where I is the interference, assuming that Interference power=1 and distance=100 what is the new formula for sigma to introduce interference and compare it with alamouti without interference..

    sigma=0.5*(1/(10^(SNRdb(i)./10)));
    sqsigma=sqrt(sigma);

  33. Hello Krishana,

    Thank you very much for all the nice posts you make.
    I want to ask regarding the Alamouti. You mentioned that Alamouti is similar to MRC in BER performance. And in the context of MIMO, Alamouti is said to achieve full diversity.

    My confusion is, since the channel is block fading and the antenna paths are uncorrelated, what will be the effect of sending [x1 x1; x2 x2]. So you send the same signal in both antennas and do MRC. In this case, how would the performance change?

    Thank you.

    1. @Maduranga: Sending the same signal from both the antennas does not provide any diversity gain.
      For eg, consider a 2tx-1rx system having
      y = h1x + h2x + n, where
      y – is the received symbol
      h1 – channel from tx antenna 1 to rx antenna
      h2 – channel from tx antenna 2 to rx antenna
      x – transmitted symbol
      n – noise
      The above can be written as
      y = (h1+h2)x + n, which kinda gives similar BER performance to y = hx+n case

      I have discussed briefly about this @
      https://dsplog.com/2009/04/13/transmit-beamforming/

  34. I am trying to implement Alamoutis 2×1 but when i am trying to check my bits are wrong. i do not know where is the problem. i am trying to solve the problem 2 days now.. and still nothing.. Plz can you help me…. I am using N=2 just only to compare my data…

    %New Test

    N=2;
    %Eb_N0_dB = [0:25];

    Eb_N0_dB =25;
    for ii = 1:length(Eb_N0_dB)
    bits= rand(1,N)>0.5 % generating 0,1 with equal probability
    s = 2*ip-1;
    h= 1/sqrt(2)*[randn(1,2) + j*randn(1,2)]; %Rayleigh Channel
    n= 1/sqrt(2)*[randn(1,2) + j*randn(1,2)]; %Noise
    % Alamouti STBC Symbols
    sCode = (1/sqrt(2)).*[s(1) -conj(s(2)); s(2) conj(s(1))];

    y=sum( sCode.*([h’ h’]))+ 10^(-Eb_N0_dB/10)*n;
    yHat=[conj(h(1))*y(1) + h(2)*conj(y(2)) conj(h(2))*y(1) – h(1)*conj(y(2))];
    hPower = h*conj(h’);
    ycombA=yHat./hPower;
    ipHatMine = real(ycombA)>0.5
    end

  35. Dear sir, I need the figures for “A Differential Detection Scheme for Transmit Diversity,”

    made by Vahid Tarokh and Hamid Jafarkhani.

    Please if you could you help me about that?

  36. hi, I want to ask a simple question:
    if there are two transmit antennas, why not we transmit the same signal in the two antennas rather than use the STBC?

  37. Dear Mr. K. Pillali

    I want to ask you why did you use
    h = (1/sqrt(2))*[randn(1,2) + j*randn(1,2)]; % Rayleigh channel
    n = (1/sqrt(2))*[randn(1,2) + j*randn(1,2)]; % white gaussian noise, 0dB variance

    the same formula for Rayleigh and Gaussian.

    i know that if we use Z= Gaussian+j Gaussian, then the amplitude of Z (|Z|) will be Rayleigh, and the phase will be uniformly distributed.

    then the amplitude of abs(h) will be Rayleigh but it has a uniform phase, also abs(n) will be Raylegih with a uniform phase.

    Also i want to ask you what is the complex Gaussian distribution, and how can we model it in Mat-Lab??

    Thank you in advance

    1. @Mohammad: Both h and n has real and imaginary parts which follow Gaussian distribution. However, the key difference is that h is a multiplicative noise, whereas n is an additive noise.

  38. Dear sir;
    i want to thank u first about BER for 2 transmit 2 receive Alamouti STBC using BPSK modulation in rayl channel it help me a lot .Second can you show me how to modify this using QAM modulation . glad if u can help me plz.

  39. I always thank you for your blog.
    It helps me.
    I remade your code in my way.
    I don’t know what is wrong in my code.
    Could you correct my code? plz

    clear
    N = 1000; % number of bits or symbols
    Eb_N0_dB = [0:25]; % multiple Eb/N0 values

    nErr=zeros(1,length(Eb_N0_dB))

    for ii = 1:length(Eb_N0_dB)

    % count=0;
    for bit=1:N
    % Transmitter
    ip = rand(1,2)>0.5; % generating 0,1 with equal probability
    s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0

    % Alamouti STBC
    sCode = (1/sqrt(2))*[s(1) -conj(s(2)); s(2) conj(s(1))];
    h = (1/sqrt(2))*[randn(1,2) + j*randn(1,2)]; % Rayleigh channel
    n = (1/sqrt(2))*[randn(1,2) + j*randn(1,2)]; % white gaussian noise, 0dB variance

    % Channel and noise Noise addition
    y=sum( sCode.*(kron(h’,[1 1])) ,1) + 10^(-Eb_N0_dB(ii)/20)*n;
    yHat=zeros(1,2);
    yHat=[conj(h(1))*y(1)+h(2)*conj(y(2)) conj(h(2))*y(1)-h(1)*conj(y(2))];
    hPower = h*conj(h’);
    ycomb=yHat./hPower;

    ipHat = real(ycomb)>0;
    % counting the errors
    if ip(1) ~= ipHat(1)
    nErr(ii)=nErr(ii)+1;
    end

    if ip(2) ~= ipHat(2)
    nErr(ii)=nErr(ii)+1;
    end
    end

    end

    simBer = nErr/(2*N); % simulated ber
    EbN0Lin = 10.^(Eb_N0_dB/10);
    theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));

    % p = 1/2 – 1/2*(1+1./EbN0Lin).^(-1/2);
    % theoryBerMRC_nRx2 = p.^2.*(1+2*(1-p));

    pAlamouti = 1/2 – 1/2*(1+2./EbN0Lin).^(-1/2);
    theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));

    close all
    figure
    semilogy(Eb_N0_dB,theoryBer_nRx1,’-‘,’LineWidth’,3);
    hold on
    % semilogy(Eb_N0_dB,theoryBerMRC_nRx2,’kd-‘,’LineWidth’,2);
    semilogy(Eb_N0_dB,theoryBerAlamouti_nTx2_nRx1,’g-‘,’LineWidth’,3);
    semilogy(Eb_N0_dB,simBer,’ro’,’LineWidth’,3);
    axis([0 25 10^-5 0.5])
    grid on
    legend(‘theory (nTx=1,nRx=1)’, ‘theory (nTx=2, nRx=1, Alamouti)’, ‘sim (nTx=2, nRx=1, Alamouti)’);
    xlabel(‘Eb/No, dB’);
    ylabel(‘Bit Error Rate’);
    title(‘BER for BPSK modulation with Alamouti STBC (Rayleigh channel)’);

  40. dear K. Pillali

    Please, i want o ask you why you used 10^(-Eb_N0_dB(ii)/20)*n in
    y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;???????

    and why its nott 10^(-Eb_N0_dB(ii)/10)*n ;

    thanx u

  41. Hello sir, need your assistance please.
    I am writing my thesis by comparing MIMO and MC -CDMA applications. I am not so good in matlab, can you please show me how write the code for this matlab file with rayleigh channel. My modulation is (8 OR 16 QAM ) because my final report will be on beyond 3G technology. thank you

  42. Hi there,
    good day. I could not understand these two lines of your codes.

    sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 …]
    sCode(:,2:2:end) = (1/sqrt(2))*(kron(ones(1,N/2),[-1;1]).*flipud(reshape(conj(s),2,N/2))); % [-x2* x1* ….]

    More specifically can you please tell me why you have multiplied it with the term (1/sqrt(2))?

    thanks in advance. 🙂

        1. @khushi: Hmm…
          1. sCode(:,1:2:end) –> taking every other element from the column, starting from the first element
          2. sCode(:,2:2:end) –> taking every other element from the column, starting from the second element

  43. Dear Mr. Krishna;

    thanx for this golden code.
    but please if we want to reproduce the figures in Nakagami fading channel instead of Rayleigh.
    How the code should be changed???

  44. i need you to help me i need to draw the probability of false alarm versus probability of miss detection when using energy detector

  45. hi
    i am working on channel estimation.problem i am facing is how to write a code for higher order modulations at ofdm transmitter i.e.8 qam and above.how to write a code for a matrix relaed to received signal data pl guide

  46. can you help me please, i read a lot of your articles, that helped me a lot.
    Hi, i have to finish my thesis by comparing some Ber curves. I am not so good in matlab, can you please show me how to modify your matlab file without rayleigh channel. (MISO channel without OFDM and only with AWGN channel, ) My modulation is QPSK but i think the ber curver are the same as for BPSK.
    I have to be ready for 12 genn 😐
    If it helps, here are other Ber graphics: (with/without Rayleigh, MIMO)
    http://zdarova.it/tesi/7genn/differenza%20tra%208%20curve.fig

  47. hi sir………..

    hi krishna…………..

    im try youre source programs……….if i use stbc with 4,6,or 8 tx n tx (tx,rx > 2) where must change in the source??

  48. Hi
    My question is that if we compare MIMO system with single antenna system, how we make fair comparison by setting same power for both case.
    for example, consider two antenna at transmitter like 2 X 1 alamouti scheme, if power=1 is used for single antenna system, so it will be half poer for each antenna to make fair comparison. Am I wright.

    Thnaks

  49. Dear krishna, lots of engineers are ask for the MIMO 2×1 with QPSK. And I changed your source, but the result failed. Can you help me to check the source? Thansk.
    clear

    Eb_N0_dB = [0:25]; % multiple Eb/N0 values

    nd = 6; % number of symbols
    ml = 2; % modulation levels
    para=256; % Number of parallel channel to transmit (points)
    N=para*nd; % number of bits or symbols

    for ii = 1:length(Eb_N0_dB)

    % Transmitter
    % ip = rand(1,N)>0.5; % generating 0,1 with equal probability
    ip = rand(1,para*nd*ml)>0.5; % generating 0,1 with equal probability

    % s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1

    % QPSK modulation**********************************************************
    paradata = reshape(ip,para,nd*ml);
    [ich,qch]=qpskmod(paradata,para,nd,ml);
    kmod=1/sqrt(2);
    s=(ich+qch.*i).*kmod;
    s = reshape(s,1,para*nd);

    % IFFT*********************************************************************
    % s=ifft(s);

    % Alamouti STBC
    sCode = zeros(2,N);
    sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 …]
    sCode(:,2:2:end) = (1/sqrt(2))*(kron(ones(1,N/2),[-1;1]).*flipud(reshape(conj(s),2,N/2))); % [-x2* x1* ….]

    % IFFT*********************************************************************
    % sCode=ifft(sCode);

    h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel
    hMod = kron(reshape(h,2,N/2),ones(1,2)); % repeating the same channel for two symbols

    n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance

    % Channel and noise Noise addition
    y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;

    % Receiver
    yMod = kron(reshape(y,2,N/2),ones(1,2)); % [y1 y1 … ; y2 y2 …]
    yMod(2,:) = conj(yMod(2,:)); % [y1 y1 … ; y2* y2*…]

    % FFT**********************************************************************
    % yMod = fft(yMod);

    % forming the equalization matrix
    hEq = zeros(2,N);
    hEq(:,[1:2:end]) = reshape(h,2,N/2); % [h1 0 … ; h2 0…]
    hEq(:,[2:2:end]) = kron(ones(1,N/2),[1;-1]).*flipud(reshape(h,2,N/2)); % [h1 h2 … ; h2 -h1 …]
    hEq(1,:) = conj(hEq(1,:)); % [h1* h2* … ; h2 -h1 …. ]
    hEqPower = sum(hEq.*conj(hEq),1);

    yHat = sum(hEq.*yMod,1)./hEqPower; % [h1*y1 + h2y2*, h2*y1 -h1y2*, … ]
    yHat(2:2:end) = conj(yHat(2:2:end));

    % receiver – hard decision decoding
    % ipHat = real(yHat)>0;

    % Hard decision decoding***************************************************
    yHat = reshape(yHat,para,nd);
    S_re = real(yHat)/kmod;
    S_im = imag(yHat)/kmod;
    [demodata]=qpskdemod(S_re,S_im,para,nd,ml);
    ipHat = reshape(demodata,1,ml*N);

    % FFT**********************************************************************
    % ipHat = fft(ipHat);

    % counting the errors
    nErr(ii) = size(find([ip- ipHat]),2);

    end

    simBer = nErr/(ml*N); % simulated ber
    EbN0Lin = 10.^(Eb_N0_dB/10);
    theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));

    p = 1/2 – 1/2*(1+1./EbN0Lin).^(-1/2);
    theoryBerMRC_nRx2 = p.^2.*(1+2*(1-p));

    pAlamouti = 1/2 – 1/2*(1+2./EbN0Lin).^(-1/2);
    theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));

    close all
    figure
    semilogy(Eb_N0_dB,theoryBer_nRx1,’bp-‘,’LineWidth’,2);
    hold on
    semilogy(Eb_N0_dB,theoryBerMRC_nRx2,’kd-‘,’LineWidth’,2);
    semilogy(Eb_N0_dB,theoryBerAlamouti_nTx2_nRx1,’c+-‘,’LineWidth’,2);
    semilogy(Eb_N0_dB,simBer,’mo-‘,’LineWidth’,2);
    axis([0 25 10^-5 0.5])
    grid on
    legend(‘theory (nTx=1,nRx=1)’, ‘theory (nTx=1,nRx=2, MRC)’, ‘theory (nTx=2, nRx=1, Alamouti)’, ‘sim (nTx=2, nRx=1, Alamouti)’);
    xlabel(‘Eb/No, dB’);
    ylabel(‘Bit Error Rate’);
    title(‘BER for BPSK modulation with Alamouti STBC (Rayleigh channel)’);

    ===============================================
    qpskmod.m
    % Program 3-9
    % qpskmod.m
    %
    % Function to perform QPSK modulation
    %
    % Programmed by H.Harada
    %

    function [iout,qout]=qpskmod(paradata,para,nd,ml)

    %****************** variables *************************
    % paradata : input data (para-by-nd matrix)
    % iout :output Ich data
    % qout :output Qch data
    % para : Number of paralell channels
    % nd : Number of data
    % ml : Number of modulation levels
    % (QPSK ->2 16QAM -> 4)
    % *****************************************************

    m2=ml./2;

    paradata2=paradata.*2-1;
    count2=0;

    for jj=1:nd

    isi = zeros(para,1);
    isq = zeros(para,1);

    for ii = 1 : m2
    isi = isi + 2.^( m2 – ii ) .* paradata2((1:para),ii+count2);
    isq = isq + 2.^( m2 – ii ) .* paradata2((1:para),m2+ii+count2);
    end

    iout((1:para),jj)=isi;
    qout((1:para),jj)=isq;

    count2=count2+ml;

    end

    %******************** end of file ***************************

    qpskdemod.m
    % Program 3-10
    % qpskdemod.m
    %
    % Function to perform QPSK demodulation
    %
    % programmed by H.Harada
    %

    function [demodata]=qpskdemod(idata,qdata,para,nd,ml)

    %****************** variables *************************
    % idata :input Ich data
    % qdata :input Qch data
    % demodata: demodulated data (para-by-nd matrix)
    % para : Number of paralell channels
    % nd : Number of data
    % ml : Number of modulation levels
    % (QPSK ->2 16QAM -> 4)
    % *****************************************************

    demodata=zeros(para,ml*nd);
    demodata((1:para),(1:ml:ml*nd-1))=idata((1:para),(1:nd))>=0;
    demodata((1:para),(2:ml:ml*nd))=qdata((1:para),(1:nd))>=0;

    %******************** end of file ***************************

    1. @KimMyungsong: For QPSK demod, instead of qpskdemod(), you can try something as simple as
      ipHat1 = real(yHat)>0
      ipHat2 = imag(yHat)>0
      Make sure that we do the ungrouping of each constellation symbol into two bits correctly.

  50. hi krishna,
    ur code is excllent for BPSK for 2X1 .
    i have modified it for MPSK and MQAM to calculate BER.
    its working for 4,8 psk but doesnt give proper curve for 16psk.
    is it necessary to demodulate signa at receiver side??
    i have used c=modem.pskdemod(M,(360/M)) for demodulation after ML decoding.
    is it correct or not???

  51. Hello Krishna,
    After the sentence “The estimate of the transmitted symbol is,” you multiplicate the the channel matrix inverse and the [y1 y2*] . The typo mistake in my opinion is that y2* depends on x2 and not x2* as you have written. So the estimation vector is [x1 x2] and not [x1 x2*]. Agree ? Apart from that you have forgotten the conjugation for x1 in the formula after the sentence “In the second time slot, the received signal is,”
    The rest is a good work, thank you !

  52. The prob. dens. function of your flat fading channel looks strange. I used dfittool with the data input abs(h) to create the PDF. It looks like a rayleigh pdf with sigma = 1 but multiplied by sqrt(2). Is there any particular reason for this? I’m using jakes model for flat fading and the pdf i get is the same as;
    x = 0:0.1:3;
    p = raylpdf(x,1);
    plot(x,p)

    Thanks for the code, it’s a great help with checking my own.

    1. @Rory: I have created the Rayleigh channel with gaussian distributed real and imaginary parts. Both real and imaginary parts are divided by 1/sqrt(2) such that the total variance is unity. Agree?

  53. you had done this alamouti stbc under BPSK modulation……..Is it possible to implement it with 16QAM modulation…….If so how to proceed along with this model.Plz help me on this…………….

  54. How do we explain this?

    pAlamouti = 1/2 – 1/2*(1+2./EbN0Lin).^(-1/2);
    theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));

    Why in theory we can model alamouti using this formula??
    How is it being done?

    Thanks so much!

  55. Hi sir,
    I wanted to use your alamouti BPSK to change it to QPSK to verify that the results will be the same. However, i couldnt get the correct curve.

    Do i need to change any of the codes in the alamouti calculation portion?
    Or do i leave it as it is, and change only the ip and s variable?
    Which is…..

    % Alamouti STBC
    sCode = zeros(2,N);
    sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 …]
    sCode(:,2:2:end) = (1/sqrt(2))*(kron(ones(1,N/2),[-1;1]).*flipud(reshape(conj(s),2,N/2))); % [-x2* x1* ….]

    h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel
    hMod = kron(reshape(h,2,N/2),ones(1,2)); % repeating the same channel for two symbols

    n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance

    % Channel and noise Noise addition
    y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;

    % Receiver
    yMod = kron(reshape(y,2,N/2),ones(1,2)); % [y1 y1 … ; y2 y2 …]
    yMod(2,:) = conj(yMod(2,:)); % [y1 y1 … ; y2* y2*…]

    % forming the equalization matrix
    hEq = zeros(2,N);
    hEq(:,[1:2:end]) = reshape(h,2,N/2); % [h1 0 … ; h2 0…]
    hEq(:,[2:2:end]) = kron(ones(1,N/2),[1;-1]).*flipud(reshape(h,2,N/2)); % [h1 h2 … ; h2 -h1 …]
    hEq(1,:) = conj(hEq(1,:)); % [h1* h2* … ; h2 -h1 …. ]
    hEqPower = sum(hEq.*conj(hEq),1);

    yHat = sum(hEq.*yMod,1)./hEqPower; % [h1*y1 + h2y2*, h2*y1 -h1y2*, … ]
    yHat(2:2:end) = conj(yHat(2:2:end));

  56. hello sir,

    Till now u have worked on ALMOUTI full rate schemes(2 tx* 2 rx). will u extend this work on fractional rate(e.g. 3 tx – 4 rx or any other combination like e.g 4 tx * 3rx). if u have any idea of implementing STBC with antenna selection{ a technique which is used to select specific antenna’s (let 2& 4) out of given four antenna’s at receiver end }. if u have any matlab program for antenna selection plz send to me

      1. Can you discuss as the 4 transmit – 2 receive Alamouti and provide its Matlab code as well. It will be of great help to me.

  57. thanks very for providing a very gud understanding of AL.STBC
    krishna can u plz tel me ..
    can u use the matlab builtin command: rayleighchan(ts,fd)
    same for bpsk modulation command :psk.modem..will it work correctly becoz in ur all codes u have made ur own qpsk n bpsk modulators…plz help me ..n one more thing to ask if m using mimo ofdm then can i considered channel as flat fading channel as u did in it..bcoz of ofdm each subcarrier will suffer flat fading instead of frequency selective fading..plz do comment whether m right or wrong
    many thanks in advance
    waiting for ur reply

    1. @mak_m: My replies:
      1/ Sorry, I do not have the function rayleshchan, psk.modem etc. Hence I built my own.
      2/ In most cases, you can consider it as flat fading for each subcarrier.

  58. can you help me please,
    i am doing project based on MIMO-OFDM for reduction of peak to average power ratio. in this case i am using CI-OFDM with SFBC instead of STBC.
    can you suggest any better technique than CI-OFDM, and how to write matlab code for CI-OFDM with SFBC.
    thank you sir.

      1. Carrier Interferometry Orthogonal Frequency Division Multiplexing
        (in CI OFDM , puts each bit/symbol on all carriers simultaneously)

          1. this CI-OFDM scheme provide frequency diversity benefit and also reduces the peak to average power ratio(for preventing non linear distortion of High Power Amplifier).
            First this(CI) scheme used at MC-CDMA. Now this(CI) used at OFDM.
            this block used between SFBC encoder and OFDM block.

  59. please tell me when simulating the almouti scheme….
    one matlab keyword using is “kron” that leads to kronecker tensor product. but in the literature it is mentioned that kronecker algebra is being used for almouti scheme.
    please tell me what is significance of using “kron” when coding for STBC.

    1. @surbhi: In the Matlab code, I used kron() to do all the operations as matrix operations and to avoid for-loops. Using kron() does not have any theoretical significance in understanding Alamouti STBC coding.

  60. A very useful post which dispelled my misconception – that when STBC is used , the minimum number of receive antennas should be 2. Thanks

  61. Dear Krishna
    Good work…
    Execuse me , I have a one question …is there a Threshold in Alamouti scheme in detection side ?
    thank you

  62. Thank u krishna for your help…..
    If my viewpoint didn’t clear, can u please read the pages (6-7) of this book (MIMO Wireless Communications.2007) in this web site :-www.4shared.com/file/112621705/f9ab90f6/MIMO_Wireless_Communications2007.html
    It will give u a clear overview of what I had pointed to
    Thank u again dear Krishna

    1. @mohanad: I looked at Fig 1.3 in the reference which you pointed. As you said,
      a) the vertical co-ordinate ‘dB’ corresponds to attenuation of the channel.
      b) the horizontal co-ordinate ‘tones’ corresponds to frequency i.e attenuation vs frequency and
      c) the horizontal co-ordinate ‘samples’ corresponds to many realization of the channel i.e attenuations vs time

  63. Hi krishna
    I have seen your code and it was great. But I want to ask u about the simulation of MIMO channel in three dimensions …. The vertical coordinate is the fading envelope, and the two horizontal coordinates are the time and distance…. I have simulated the fading with the time by using jakes mode but I don’t know how i can simulate the fading with distance for 2*2 real world MIMO channel. At least give me an equation of fading with distance.
    Thank u in advance…
    This is my fading simulation with time:-
    clear
    t_sample = 0.001;
    t = (0:8/t_sample)*t_sample;
    fc = 220.5625*10^6;
    N = 100;
    c = 2.998*10^8;
    v = 45*1000/3600;
    lambda = c/fc;
    fd = v/lambda;
    f = linspace(-1/t_sample*1/2,1/t_sample*1/2,16000);
    Eo = 1;
    sigma = 1;
    Cn = 1/(2*pi);
    alpha = rand(1,N).*2*pi;
    phi = rand(1,N).*2*pi;
    Tc = zeros(1,length(t));
    Ts = zeros(1,length(t));
    for n = 1:N; % loop to superimpose the N signals
    Tc_n = Cn*cos(fd*2*pi*t*cos(alpha(n))+phi(n));
    Ts_n = Cn*sin(fd*2*pi*t*cos(alpha(n))+phi(n));
    Tc = Tc+Tc_n;
    Ts = Ts+Ts_n;
    end
    Env = (Tc.^2 + Ts.^2).^0.5;
    plot(t(1:4/t_sample),10*log10(Env(1:4/t_sample)))
    title(‘Received Signal Envelope’);
    xlabel(‘time (s)’)
    ylabel(‘Magnitude of E Field (dB)’)

    1. @mohanad: Am not sure, I fully understood your question nor the code which you have posted. Typically, more the distance, higher will be the RMS delay spread of the channel.
      One good reference for MIMO channel model is defined by the High Throughput study group for 802.11n standards development –
      Tgn Channel Models, Vinko Erceg et al.
      The document provides a good overview of MIMO channel modeling – including the effect of antenna correlation (based on antenna spacing). effect of fluorescent lights, doppler, indoor multipath characteristics.

      Hope this helps.

  64. dear
    We haveMultiple InputMultiple Output (MIMO) digital communication system consisting of two transmit
    antennas (NT = 2) and one receive antenna (NR = 1).
    Alamouti space-time (ST) block code is defined by folowing NT × L code matrix
    X =  x1 −x
    2
    x2 x
    1 
    where L is a codeword length.
    • implement a digital modulator involving Alamouti STBC
    • modulated signal passes frequency-flatMIMO fading channel with AWGN
    • construct a decoder for given communication system
    • compare the performance of given system with the reference (scalar, SISO) system — display BER
    (or SER) curves in the same figure
    thanks, chadi_lb@hotmail.com

  65. Hi Krishna Pillai

    first of all thank you for your post. it’s clearly and understandable

    I’ve just studied a bit about transmit diversity scheme of Mr Alamouti. I just have some general questions.
    1. Can you tell me why Alamouti scheme is introduced? in fact it is 3dB poorer than MRC.
    2. If we use this scheme we’ll need double power in order to get the similiar BER curve like MRC. I just wonder why?
    3. Could you suggest me a recevier which is with lower complexity than the MLSE

    I know that i don’t have much time but hope you enjoy answering and discussing some questions. thanks in advance

    Phan

    1. @Phan Minh Hoang: My replies
      1. Though it is 3dB poorer than MRC, Alamouti scheme provided a way where we can put the complexity of two transmit antennas at the base station side. If you recall, when Alamouti scheme came about circa 1998, there were not too many takers where a mobile device can have multiple receive antennas

      2. Thats because the math plays out that way. 🙂

      3. For MIMO communications, we can use equalizers like ZF, MMSE, successive interference cancellation etc. Please check http://www.dsplog.com/tag/mimo

      Hope this helps.

  66. can you help me where’s my error??

    N = 10^6; % number of bits or symbols
    Eb_N0_dB = [0:25]; % multiple Eb/N0 values

    for ii = 1:length(Eb_N0_dB)

    % Transmitter
    ip = rand(1,N)>0.5; % generating 0,1 with equal probability
    s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 0

    h = 1/sqrt(2)*[randn(1,2) + j*randn(1,2)]; % Rayleigh channel

    n = 1/sqrt(2)*[randn(1,2) + j*randn(1,2)]; % white gaussian noise, 0dB variance

    S_c = [s(1) -conj(s(2)); s(2) conj(s(1))];
    % Channel and noise Noise addition
    y = sum(hMod.*S_c,1) + 10^(-Eb_N0_dB(ii)/20)*n;

    S_S(1) = conj(h(1))*y(1)+h(2)*conj(y(2));
    S_S(2) =conj(h(2))*y1-h(1)*conj(y(2));
    %Reciever
    mpower=h*conj(h); %equalization
    H1 = S_S(1)/mpower;
    H2 = S_S(2)/mpower;
    decoded_S=real(y)>0;
    % counting the errors
    nErr(ii) = size(find([ip- decoded_S]),2);
    PER=nErr(ii)/Eb_N0_dB;
    plot(PER,N);
    hold

    end
    simBer = nErr/N; % simulated ber
    EbN0Lin = 10.^(Eb_N0_dB/10);
    theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));

    p = 1/2 – 1/2*(1+1./EbN0Lin).^(-1/2);
    theoryBerMRC_nRx2 = p.^2.*(1+2*(1-p));

    pAlamouti = 1/2 – 1/2*(1+2./EbN0Lin).^(-1/2);
    theoryBerAlamouti_nTx2_nRx1 = pAlamouti.^2.*(1+2*(1-pAlamouti));

      1. y = sum(hMod.*S_c,1) + 10^(-Eb_N0_dB(ii)/20)*n;
        i also tried…
        y=h*s+10^(-Eb_N0_dB);
        but there’s also error….

  67. plz help me…..i need a code mor alamouti stbc for BPSK (likelihood detection)
    using only for loops or while loops…..without using reshape,rand functions……so can you help me please??
    thannx alot…

  68. Hi,Krishna,would you help me coding a program about Maximum Likelihood Detection for Alamouti-STBC system? Under QPSK modulation condition,My program didn’t get perfect result,So I’d like to see your help.Thanks!

    1. @gly: Sorry, due to time considerations, I would not have time to help you in the coding for QPSK systems. However you may use the post on Symbol Error Rate for QPSK in AWGN as a reference
      https://dsplog.com/2007/11/06/symbol-error-rate-for-4-qam/

      I would think that the Zero forcing equalizer discussed in this post is optimal (and gives the same performance as ML) for Alamouti STBC system. Hence, I think it should be reasonably simple to extend this post to QPSK systems.

  69. @ Krishna and @Abubaker.

    Can u please tell me how to modify alamouti to QPSK. I am gettin simulated BER 6 db higher than BPSK case. and also confused about theoritical values. Pl help!!!

  70. I already read the receive diversity blog, and I need to simulate alamouti 2X1 with channel correlation, how can I implement in the code because I only find the theoretical formula, I hope you can help me with this issue.
    Regards

  71. hi krishna!!
    i am working on cooperative communication systems…… can u help me in this regard???? if u have simulated cooperative mimo enviornment kindly info me.

    the point that confuses me is that how we decide at the destination node to use which type of equalizer i-e LMS, DFE etc etc.
    secondly do we combine signals before equalization or after that

    regards

    1. @sara: Sorry, I have not worked on co-operative communications. Anyhow, trying to answer the queries:
      1/. Typically, the type of equalizer which is selected depends on the complexity considerations and the performance gain
      2/, I think equalizer takes care of the job to effectively combine the signal resulting in minimal BER.

  72. hi krishna..do we need to divide the snr by 2 in the equation of bpsk to get qpsk curve in theoretical case or is it the same..or is it like only for high snr case only..for finding the probablity of error for diversity schemes ..im bit confused about that can u pls tel that

  73. I was implementing the code with QPSK. Would everything other than the encoding (given below) be the same ?

    ip = (2*(rand(1,N)>0.5)-1) + j*(2*(rand(1,N)>0.5)-1);

    The decoder would also be modified accordingly.

    I am not getting any gain over 1TX using QPSK. Pl. help! Thanks!

    1. Hi ,

      I’m here with one more doubt. I have a project on transmitter diversity. Can the alamouti scheme be applied to the UPLINK for CDMA systems– (where noise interference would be due to multiple users) ? Or it has to be at the base station ? I am having this conceptual doubt …

      Sorry to have asked so many questions at one go..
      Would be really grateful if you could help! Thanks!

      1. @UP: Well, theoretically there is nothing stopping us from using Alamouti STBC in either uplink or downlink. In the past, I recall reading that Alamouti coding is done at the Base station (which has more computational power and more transmit atennas) and the subcriber stations (have the capability for doing demodulation).

        1. @UP: If you have two transmit antennas, it should be ensured that the sum power of the signals coming from both antennas should be equal to transmit power in the case of single antenna.

  74. Hi, Instead of hard decision coding, can u actually implement a Maximum likehood decoder for M-PSK encoding ? How do you think could that be implemented ?

    1. @UP: Well, the brute force ML method is to find the minimum of error between received transmit constellation and receieved constellation. However, I think there is no advantge in doing the brute force ML as the hard decision decoding is also optimal, agree?

  75. Hi,Krishna Pillai,
    would you help me Model the STBC-OFDM or DSTBC-OFDM system using the simulink toobox? Email:115473189@qq.com
    Thank you!

  76. hi..can u tel me what is the equation for probablity of error for correlated raylegh flat fading channel (with correlation factor )for mrc (1*2) and alamouti (2*1) using qpsk ..

          1. one more thing the equation u have given the above link its wrong..they have small printing mistake so its better to look in this text book .R. Janaswamy, Radiowave Propagation and Smart Antennas for Wireless Communications.
            Kluwer Academic Publishers, 2000.

          2. @abubaker: Can you please point to the error in the equation. If there is indeed an error, I will correct it.
            I referred Digital Communications by Barry, Lee, Messerchmit.

  77. hi krishna,
    Thanks for your excellent work.
    I am doing a work on MIMO-OFDM with Alamouti 2×1 code.Would you like to send me a matlab code for flat rayleigh fading channel with QPSK modulation?Furthermore,would you model it using the simulink toolbox and send me a *.mdl file?
    Hoping your replay.
    Thanks very much.

      1. hi krishna..do we need to divide the snr by 2 in the equation of bpsk to get qpsk curve in theoretical case or is it the same..or is it like only for high snr case only..im bit confused abot that can u pls explain it

  78. Krishna: At first, good post.
    Now, few questions: You wrote “For convineance, the above equation can be represented in matrix notation as follows:”..and this is followed by a matrix notation of the system response. I find that in such a matrix, the functionality of X* has been moved to H*. Although we are allowed to do such operations freely, in practise it seems to suggest that the channel reposnse during the second time slot is the complext conjugate of its own response in the first time slot – right? Don’t you think over a short interval of time such a generalization is rather too extreme?
    In my view, transmitting X* during second time slot is going to be totally independant of channel reposnse during its transmission. So, convertibility between X* to H* is not going to be simple over such short time periods. May be over the long it’s possible…

    Please feel free to critiqe my understanding

    Thanks for you time,
    DRAM

    1. @DRAM: For STBC, we assume that the channel is same over two time slots. Given that we make the assumption, its just for mathematical notional convineance, we formulate the channel in matrix form by using H*. So, the fact that we are using H* in matrix notation does not mean that the channel H in first time slot became H* in the second time slot. Hope this helps.

  79. Hai krishna sir can u please send matlab programm for QOSTBC based on flat rayleigh fading channel with QPSK modulation

  80. Hai..i am doing my M.Tech project on COSTBC can u send matlab code for flat rayleigh fading channel with QPSK modulation or suggest some useful sites regarding my project

  81. Hi Krishna & others,

    I’m afraid I’m still struggling with Alamouti 2×2.

    Can someone pls help to show/point where I’m doing wrong in my current simulation (getting extremely high BER):
    1) input data modified to Alamouti scheme
    2) generate 4 paths (divided into 2 sets to ensure the channel remain constant for 2 timeslot at least at each antenna)
    3) 2 independent AWGN
    4a) combine path1&2 with signal & add noise 1.
    4b) combine path 3&4 with signal & add noise2.
    5) perform 2 separate channel equalization
    to get 2 estimated transmitted data
    6) perform MRC based on original channel in (2)
    7) count error

    please help.. running out of ideas 🙁

    1. First you should try to duplicate the process (2×1) of equalization for the second receiving antenna and retrieving data using only the second antenna, you should obtain the same BER.

      Then you can use MRC to obtain BER of 2×2 correctly, note that as stated before the equations for MRC and Alamouti equalization are the same so when after equalizating Alamouti at the second (or duplicated process) antenna applying MRC is reduced to add both of “yHat”

  82. hi,

    i was informed that equalization like ZF and MMSE is only used when you expect the received signal is not orthogonal.

    so, in the case of for Alamouti 2×2 MIMO (orthogonal), how do I modify the equalization matrix into 2 receiver for BPSK?
    what’s the method to expand this to QPSK&QAM?

    e.g. in the given Matlab code:
    rx_Mod = kron(reshape(rx,2,N/2),ones(1,2));
    rx_Mod(2,:) = conj(rx_Mod(2,:));
    % forming the equalization matrix
    hEq = zeros(2,N);
    hEq(:,[1:2:end])=reshape(h,2,N/2);
    hEq(:,[2:2:end]) = kron(ones(1,N/2),[1;-1]).*flipud(reshape(h,2,N/2));
    hEq(1,:) = conj(hEq(1,:)); hEqPower = sum(hEq.*conj(hEq),1);

    please help

    1. @lia: Yes, when there is cross-coupling ZF and MMSE wont be optimal.
      However, in the presence of Alamouti coding, the coding structure ensures that there is no cross-coupling. So ZF is optimal even in 2Tx 1Rx Alamouti case.

      I would think that, to extend to 2Tx, 2Rx case one needs to write the received symbol equations for the second antenna in addition. The information from multiple rx antennas can be combined the MRC way (i think). I need to write the equations to confirm. Can you please try that. Please share your results.

      Good luck.

  83. Hi Krishna,

    Could you explain what E{.} expectation operater for me please. What is it for? why do we have to find E{.}

    Thank you

    1. @Paul: The E{.} operator find the mean of a set of observations. The E{.} operator is used to show that mean of |n1}^2 corresponds to noise variance. The mean of n1*n2 = 0 as the noise is uncorrelated.

  84. @farie: No, I do not. However, may I suggest that debugging 4QAM, 16QAM cases should be reasonably easy. I think as a first step, you can try with
    (a) Make all the channel coefficients unity
    (b) No noise.

    Once you are able to receive perfectly what was transmitted, then move on to add channel and noise.

    Hope this helps.

  85. hey Krishna

    Do you have Alamouti 2×1, 2×2 STBC in 4QAM and 16QAM codes? I am having problems in combining the modulated 4qam and 16qam signals with channels.

  86. @alvina: If you look at the system model equation, we took the conjugate of the second equation to enable us conveniently represent both the equation in matrix form.

    So, when we solve for that equation, what we estimate is the conjugate of what we have transmitted.

    For the noise term, we are finding the average noise power, which is the the E{n*n^H}.

  87. Hi

    can u plz tell me why you have taken tne conjugate (* sign) over noise symbol n2 and n1 (after the sentences)
    Since the two noise terms are independent and identically distributed,

  88. hi Krishna

    can you plz tell me why you have taken the conjugate of estimated received signal X. (after this sentences)
    The estimate of the transmitted symbol is,

  89. @ila: Can you please point to the line in the code where the error in the note is present?
    Also, kindly do note that in the simulation model, to speed up simulation time, I have tried to use matrix operations as far as possible. For doing so, I may have played around with matrix dimensions (which might not be very intuitive). Hopefully the comments help.

    Similar equalization should hold good for QPSK too. Try for a no-noise case, see whether you can recover the QPSK symbols accurately.

  90. hi krishna.
    sorry. pls ignore my earlier question. i think there is typo mistake in the notes:

    should be:
    H* = [h1* h2* … ; h2 -h1* …. ]

    in notes written:
    H* = [h1* h2 …; h2* -h1]

    btw, i tried to implement this for QPSK (modify from your entry on BER QPSK in Rayleigh – but seems the curve is very weird.. forever error rate ~0.5). is there a different equalization method?

    btw, thanks for all the update! they’re all very helpful. without this, i dont think i can start with my assignment at all 😉

  91. hi krishna,
    need help to explain:

    hEq(:,[2:2:end]) = kron(ones(1,N/2),[1;-1]).*flipud(reshape(h,2,N/2)); % [h1 h2 … ; h2 -h1 …]
    hEq(1,:) = conj(hEq(1,:)); % [h1* h2* … ; h2 -h1 …. ]

    why is it not the same as in the derivation??
    H= [h1 h2; h2* -h1*]

  92. thanks for the info…. It has been quite helpful. I would like information pertaining to MIMO and associated channel capacity

Leave a Reply

Your email address will not be published. Required fields are marked *