Week 01 – Alamouti Code

The famous Alamouti Code is now a part of GNU Radio’s basic MIMO capability! Read more about the Alamouti code itself and my implementation in this article.

Space Time Block Codes

Using a Multiple Input Multiple Output (MIMO) system adds the new dimension space (via multiple antennas) to the pool of  degrees of freedom, next to frequency, time, code, polarization, etc., that a system designer can use. This gives the possibility to distribute the signal not just over time, but over an other (or multiple) dimension. We all know this technique from Frequency Division Multiplexing (FDM), where the data is split into multiple streams which are simultaneously transmitted over time, each on a different sub-carrier.

The same principle underlays Space Time Codes (STCs), where the data is distributed over time and space. Space-time block-codes (STBCs) are a less complex alternative to common STCs, having a linear receiver complexity while still extracting excellent diversity gain [1]. Thanks to their linearity, STBCs can be described with a matrix.

The transmission at a single symbol time can be described by

for a MIMO system with M transmitting antennas and N antennas at the receiver side. To describe a STBC, we have to add the dimension time to the scheme. Thanks to the block character of STBCs, the time dimension is limited to the block length T. This would results in


Fortunately, we don’t have to deal with 3-dimensional matrices. Instead we can pass each column of S separately through the channel, and therefore again calculating each time step separately. However, we still have to generate the 2-dimensional transmission matrix S. Instead of defining an other matrix multiplication that produces out of the input vector s, we simply define a generator matrix:


describes the distribution of the STBC over space with M rows, and over time with T columns. The matrix elements of G are the modulated transmission symbols. The number of different data symbols k (= dim(s)) which are included in G define the code rate r=k/T. The maximum code rate is r=M, where each transmitted symbol at each antenna and each time slot is a different input symbol. The minimum code rate is r=1/T. In this case, we would take one input symbol and transmit it over all antennas and repeat it M T times. The choice of r depends on the trade-off between data rate and diversity gain.

Alamouti Code

A very popular STBC is the Alamouti code. It is defined with the generator matrix

As you can see, the number of transmit antennas is M=2 and the code rate is r=2/2=1. The data rate does not change when applying this code. What makes the Alamouti code so popular is the fact that it is the only STBC that achieves full diversity gain without a reduction of the data rate [2]. This quality of full diversity gain comes from an orthogonal design of the STBC. Orthogonal STBCs have the additional advantage of a linear decoding complexity at the receiver [3]. I won’t dive into theoretical details of orthogonal STBCs (you can read more about it in [1],[2],[3]) and directly go on with the decoding at the receiver.

After going through the channel (we ignore the noise for this calculation), the signal that arrives at the receiver looks like:


The decoder can now separate the input data symbols with the help of CSI:


After a normalization, the input symbols are restored completely in y. The inclusion of AWGN in the channel model would lead to a disturbance of the received signal, but the important message here is the fact that the two input signals can be separated completely from each other (thanks to the orthogonal design) although they are traveling through the same physical channel at the same time.


The implementation of the Alamouti code includes an encoding and decoding block, both written in C++. The validation of the code is done by a QA test for each block respectively and a loopback test which validates the encoder and decoder against each other.

The structure of the C++ blocks is very simple:

The encoder takes a sequence of two input samples at a time and calculates the 2×2 generator Matrix for Alamouti code. This matrix is directly transmitted over the two TX antennas by splitting the matrix up into two row vectors that define the transmitted symbol sequence at each antenna, respectively. I am explicitly using the expression ‘sequence’ instead of vector to clarify, that the encoder block works in stream mode, but processes two input samples at a time. To ensure an even number of samples in the input buffer, I called set_output_multiple(2in the constructor.

The decoder works with the same scheme. In contrast to the encoder, the decoder needs channel state information to decode the signal. This is provided via stream tags and handled in the same way as in the diversity combining block. You can find details in the related blog post.

The tests for the blocks are written in python. They simply feed random data into the block and compare the output data with the result, they calculated themselves. The loopback test works in a different way: Random data runs through the block chain encoder – channel model – decoder. A calculation of the expected result is not necessary, because we expect the output of the decoder to be equal to the input data we fed into the encoder. For the channel model in a test environment, it is sufficient to implement a static and frequency flat channel, simply representing the constant channel matrix H which combines the symbol vectors of transmitter s and receiver r in a linear way. The elements of correspond to the complex path coefficients, describing the attenuation and phase shift of one branch between two specific TX and RX antennas. In the case of Alamouti, the channel matrix is a 2×1 matrix, because we use 2 transmitter antennas but only one receiver antenna.

To use the produced blocks as well in GNU Radio Companion (GRC), I created .xml files for each C++ block. Together with my mentors, I decided to create a new category ‘MIMO’ in GRC where all the produced block of this GSoC project are going to be organized.


Next week, I am going to look deeper into a differential STBC approach after [4]. A differential scheme is a nice addition to this collection of basic MIMO algorithms, because it allows a complete MIMO transmission and reception without the need of CSI neither at TX nor at RX!​


[1] Andrea Goldsmith. 2005. Wireless Communications. Cambridge University Press, New York, NY, USA.

[2] Vahid Tarokh; Nambi Seshadri & A. R. Calderbank (March 1998). “Space–time codes for high data rate wireless communication: Performance analysis and code construction”. IEEE Transactions on Information Theory44 (2): 744–765. doi: 10.1109/18.661517.

[3] V. Tarokh, H. Jafarkhani and A. R. Calderbank, “Space-time block codes from orthogonal designs,” in IEEE Transactions on Information Theory, vol. 45, no. 5, pp. 1456-1467, Jul 1999. doi: 10.1109/18.771146

[4] V. Tarokh and H. Jafarkhani, ”A differential detection scheme for transmit diversity,” in IEEE Journal on Selected Areas in Communications, vol. 18, no. 7, pp. 1169-1174, July 2000.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s