(32 votes, average: 4.38 out of 5)

# Alamouti STBC

by on October 16, 2008

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 $\{x_1, x_2, x_3, \ldots, x_n \}$

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

3. However, Alamouti suggested that we group the symbols into groups of two. In the first time slot, send $x_1$and $x_2$from the first and second antenna. In second time slot send $-x_2^*$ and $x_1^*$from the first and second antenna. In the third time slot send $x_3$ and $x_4$from the first and second antenna.In fourth time slot, send $-x_4^*$ and $x_3^*$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 $i^{th}$ transmit antenna, each transmitted symbol gets multiplied by a randomly varying complex number $h_i$. As the channel under consideration is a Rayleigh channel, the real and imaginary parts of $h_i$ are Gaussian distributed having mean $\mu_{h_i}=0$ and variance $\sigma^2_{h_i}=\frac{1}{2}$.

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$n$ has the Gaussian probability density function with

$p(n) = \frac{1}{\sqrt{2\pi\sigma^2}}e^{\frac{-(n-\mu)^2}{2\sigma^2}$ with $\mu=0$ and $\sigma^2 = \frac{N_0}{2}$.

7. The channel $h_i$ is known at the receiver.

In the first time slot, the received signal is,

$y_1 =h_1x_1 + h_2x_2 + n_1 = [h_1\ h_2] \left[\begin{eqnarray}x_1 \\ x_2 \end{eqnarray}\right]+n_1$.

In the second time slot, the received signal is,

$y_2 =-h_1x_2^* + h_2x_1^* + n_2 = [h_1\ h_2] \left[\begin{eqnarray}-x_2^* \\ x_1^*\end{eqnarray}\right]+n_2$.

where

$y_1$, $y_2$ is the received symbol on the first and second time slot respectively,
$h_1$ is the channel from $1^{st}$ transmit antenna to receive antenna,
$h_2$ is the channel from $2^{nd}$ transmit antenna to receive antenna,
$x_1$, $x_2$are the transmitted symbols and
$n_1,\ n_2$ is the noise on $1^{st}, 2^{nd}$ time slots.

Since the two noise terms are independent and identically distributed,

$E\left{\left[\begin{eqnarray}n_1\\n_2^*\end{eqnarray}\right]\left[\begin{eqnarray}n_1^*\ n_2\end{eqnarray}\right]\right}=\left[\begin{eqnarray}|n_1|^2\ \ \ \ 0 \\0\ \ \ \ |n_2|^2\end{eqnarray}\right]$.

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

$\left[\begin{eqnarray}y_1 \\ y_2^*\end{eqnarray}\right] = \underbrace{\left[\begin{eqnarray}\ h_1\ \ \ h_2 \\ h_2^*\ -h_1^*\end{enarray}\right]}\left[\begin{eqnarray}x_1 \\ x_2 \end{eqnarray}\right]+\left[\begin{eqnarray}n_1\\n_2^* \end{eqnarray}\right]$.

Let us define $\mathbf{H}= \left[\begin{eqnarray}\ h_1\ \ \ h_2 \\ h_2^*\ -h_1^*\end{enarray}\right]$. To solve for $\left[\begin{eqnarray}x_1 \\ x_2 \end{eqnarray}\right]$, we know that we need to find the inverse of $\mathbf{H}$.

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

$\mathbf{H^+}=(H^HH)^{-1}H^H$.

The term,

$(H^HH) = \left[\begin{eqnarray}\ h_1^*\ \ \ h_2 \\ h_2^*\ -h_1\end{eqnarray}\right]\left[\begin{eqnarray}\ h_1\ \ \ h_2 \\ h_2^*\ -h_1^*\end{eqnarray}\right]=\left[\begin{eqnarray}|h_1|^2+|h_2|^2\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 \\ 0\ \ \ \ \ \ \ \ \ \ \ \ \|h_1|^2+|h_2|^2\end{eqnarray}\right]$. Since this is a digonal matrix, the inverse is just the inverse of the diagonal elements, i.e

$(H^HH)^{-1} = \left[\begin{eqnarray}\frac{1}{|h_1|^2+|h_2|^2}\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 \\ 0\ \ \ \ \ \ \ \ \ \ \ \ \frac{1}{\|h_1|^2+|h_2|^2}\end{eqnarray}\right]$.

The estimate of the transmitted symbol is,

$\begin{eqnarray}\hat{\left[\begin{eqnarray}x_1 \\ x_2\end{eqnarray}\right]} & = &(H^HH)^{-1}H^H\left[\begin{eqnarray}y_1 \\ y_2^* \end{eqnarray}\right]\\
& = & (H^HH)^{-1}H^H\left(H\left[\begin{eqnarray}x_1 \\ x_2 \end{eqnarray}\right]+\left[\begin{eqnarray}n_1\\n_2^* \end{eqnarray}\right]\right)
\\&=&\left[\begin{eqnarray}x_1 \\ x_2 \end{eqnarray}\right] + (H^HH)^{-1}H^H\left[\begin{eqnarray}n_1\\n_2^* \end{eqnarray}\right]\\\end{eqnarray}$
.

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,

$P_{e,MRC} =p_{MRC}^2\left[1+2(1-p_{MRC})\right]$, where

$p_{MRC}=\frac{1}{2}-\frac{1}{2}\left(1+\frac{1}{E_b/N_0}\right)^{-1/2}$.

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

$p_{STBC}=\frac{1}{2}-\frac{1}{2}\left(1+\frac{2}{E_b/N_0}\right)^{-1/2}$ and Bit Error Rate is

$P_{e,STBC} =p_{STBC}^2\left[1+2(1-p_{STBC})\right]$.

## Key points

The fact that $(H^HH)$ is a diagonal matrix ensured the following:
1. There is no cross talk between $x_1$, $x_2$ after the equalizer.

2. The noise term is still white.

$E\left{H^H\left[\begin{eqnarray}n_1\\n_2^*\end{eqnarray}\right]\left[\begin{eqnarray}n_1^*\ n_2\end{eqnarray}\right]H\right}=H^H\left[\begin{eqnarray}|n_1|^2\ \ \ \ 0 \\0\ \ \ \ |n_2|^2\end{eqnarray}\right]H=\left[\begin{eqnarray}|n_1|^2\ \ \ \ 0 \\0\ \ \ \ |n_2|^2\end{eqnarray}\right]\left[\begin{eqnarray}{|h_1|^2+|h_2|^2}\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 \\ 0\ \ \ \ \ \ \ \ \ \ \ \ {\|h_1|^2+|h_2|^2}\end{eqnarray}\right]$.

## 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.

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

(f) Repeat for multiple values of $\frac{E_b}{N_0}$ and plot the simulation and theoretical results.

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

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

D id you like this article? Make sure that you do not miss a new article by subscribing to RSS feed OR subscribing to e-mail newsletter. Note: Subscribing via e-mail entitles you to download the free e-Book on BER of BPSK/QPSK/16QAM/16PSK in AWGN.

ferdousi January 29, 2015 at 7:32 pm

matrix for alamouti STBC for 3X3 antenna

EagleDumpsterRental January 11, 2015 at 12:15 pm

Thanks for any other excellent article. The place else could anybody get that
kind of information in such a perfect method of writing? I’ve a presentation next week, and
I am aat thhe search for such info.

Saiful January 6, 2015 at 8:52 pm

SIr, i was looking for the theoryber equation for alamouti 2 transmit and 2 receive antennas

ashwini January 1, 2015 at 3:15 pm

AND SIR i kindly require 2×2 stbc-ofdm simulink model for rayleigh channel with 16 QAM…CAN YOU HELP ME PLZ????

ashwini January 1, 2015 at 3:12 pm

Sir can you plz tell me that is it coreect if we connect stbc before ofdm at the transmitter side and vise a versa at the reciver side in mimo-ofdm system …
plz help….

mahendar December 16, 2014 at 12:48 pm

Hi Krishna,

I have a doubt in your code. Alamouti does not depends on channel state information.So we have to find channel matrix from the received signals. But you have used the generated channel matrix (I mean channel coefficients) in your code to equalize.
How come it is true???

ดูหนัง October 12, 2014 at 8:23 pm

ดีจ้า มาบอกเว็บ ดุหนังออนไลน์มีแต่เรื่องใหม่ๆ น่าดูกันทั้งนั้น ชอบ
ไหมละน้อ เว้บหนังใหม่ๆ
อัพเดรตทุกวันทุ 24 ชม.

ชอบไหมกับการดูหนังเรื่องเก่าๆถ้าชอบดูหนังออนไลน์พอประมาณ ก็ดูหนังเต็มเรื่องไปเลย
ไม่เชื่อเท่าไร ชอบหนังเราไหม ชอบๆ กำลังพาเราหาดูหนัง
หนังสนุกๆ

chatten zonder registratie October 11, 2014 at 4:00 pm

nnen Sie Ihr Smartphone ALS Gamepad benutzen und verwenden Sie Ihre Tablet
, diese TV steuern . snyggast chatten sites geven de leden de mogelijkheid om met behulp van audio -en video-
snyggast chattsession alsook . Nicole Byblow is een adem
van verse lucht in de muziek industrie .

Gabriel October 10, 2014 at 2:18 am

It really is now known that pressure, sunlight, That is where the word
‘chilly sore’ grew to be descriptive of the infection.

Harshit Patel October 7, 2014 at 1:11 pm

sir, i m working in MC-CDMA for discontinuous spectrum, sir i required CARRIER -INTERFEROMETRY code , matlab coding for spreading purpose to improve BER, i did walse code , PN code….
please sir help me on this…

chatten met vreemden October 7, 2014 at 8:06 am

- Controleer uw rijbewijs te zorgen dat het blijven geldig , terwijl je op reis bent .

Regelmatig hoor IK Mijn man van zoon roepen DAT IK de computer also Eens aan de
kant Moet Zetten . Verder testing we de Asus Transformer Prime , Vier Sandy Bridge – Moederborden en analyseren we webverkeer ontmoetten Google
Analytics and other gereedschappen .

chomikuj.pl October 7, 2014 at 3:49 am

Those 30 minutes give the fluoride sufficient time
to fight cavities by rebuilding weakened enamel.
Women wanted to keep their skin looking healthy and attractive every time, which is why they kept on looking for methods that will help them maintain the youthful glow of their skin. It is simply because soaps contain harmful chemicals that can cause skin cell damages
like excessive dryness.

Automatic Gates Pakistan October 4, 2014 at 1:57 am

The consultants present automation to your garage doorways
and other doors.

koty.pl September 25, 2014 at 1:24 pm

Wipe it on the areas where the tan is at its darkest to
even out the tone. We all love beauty but for most it is simply an expense that we use to buy the
beauty products that we like in stores or malls but
what if there was a way that you could profit from the top of the line beauty
products. And, when it comes to extraordinary beauty and comfort in kitchens
and bathroom comforts, granite countertops are the single most products to consider.

minecraft games September 23, 2014 at 4:19 am

Right here is the right website for anybody who really
so much its almost hard to argue with you (not that I personally would want to…HaHa).
You definitely put a new spin on a subject which has been discussed for many years.
Great stuff, just excellent!

weight loss calculator losertown September 21, 2014 at 3:04 am

cass sunstein September 20, 2014 at 8:50 pm

I’d like to find out more? I’d want to find out

blog publishers September 20, 2014 at 7:28 pm

you’re in point of fact a just right webmaster. The website loading speed is incredible.
It kind of feels that you are doing any unique trick.

Also, The contents are masterwork. you’ve done a great activity
in this subject!

dads band September 17, 2014 at 9:33 am

Hello there! I know this is kind of off topic but I was wondering if you
knew where I could find a captcha plugin for my comment form?
I’m using the same blog platform as yours and I’m having trouble finding one?
Thanks a lot!

farha September 15, 2014 at 2:11 pm

AM designing almouti STBC FOR 4X2 SYSTEM CAN YOU Phelp me with coding

singles September 9, 2014 at 4:56 pm

Apple launched i – Phone 4 in late June while already enjoying the success with i – Pad.

We’re doing the Morgan Page tour up until then and then after that we’re doing a couple more weekend shows and then we’re going to take
two weeks off in December and hit the ski slopes and just relax and hit some studio time and
then we’ll be back at in January for touring and stuff.
Those who are looking to chat on the phone for this type of line should
make sure that they know how to go about continuing to talk to the person on
the other end.

chatten zonder registratie September 9, 2014 at 4:25 pm

Apple launched i – Phone 4 in late June while already enjoying the success with i – Pad.

Generally , people use text to communicate but, it is no longer just text that is used; it has become a multimedia affair.

You interact with people, make good friends, change ideas and
at last earn money while chatting with them.

Zandra August 13, 2014 at 8:02 pm

We are a bunch of volunteers and opening a new scheme in our community.
Your web site offered us with useful info to work on. You’ve performed an impressive process and our entire group will
be thankful to you.

Abhinav August 13, 2014 at 2:19 pm

just to verify , isnt this line of code wrong ?? :

yHat(2:2:end) = conj(yHat(2:2:end));

this line should be commented out/erased as it is incorrect .
However it doesnt make a difference in this case as only real part is considered .

Can anyone verify the same ??

Rohit May 3, 2014 at 4:59 pm

Hello Sir,
I am a graduate from IIT Kharagpur, India. I want to know the difference between Alamouti scheme and the MIMO technology. How are they different in terms of implementation. Please help me

Johnny April 26, 2014 at 9:10 pm

Hi Krishna,

I was wondering if you could help me? How does the theoretical bit error rate for Alamouti change when I change everything for QPSK or 16 QAM I can’t seem to find the probability for STBC for QPSK or QAM. I see you have it for BPSK but how would that change for QPSK and QAM.

Thanks

Johnny

siri April 17, 2014 at 7:02 pm

Sir, I doing a project on Energy Efficient Virtual MIMO Communication for Wireless Sensor Networks.I need matlab code for Energy Consumption of Virtual MIMO for Fixed and Variable Rates. Can you help me out

pip April 16, 2014 at 6:37 am

urgently i need matlab code for 4 transmit antenna alamouti scheme. please help me a soon as possible

jyothi July 21, 2013 at 3:23 pm

i need alamouti matlab codes for 2×1,2×2,mimo system
plz help me,

Krishna Sankar July 22, 2013 at 4:20 am

Kishor July 17, 2014 at 6:26 am

Hi Krishna,

I found your code is very much useful for research. I need matlab code for PAPR for the scheme you are implemented. If you can send it to my email, that will be great.

Thank you.

Italo March 21, 2013 at 12:13 am

Hello sir Krishna, I’m student of electrical engineering from Brazil and I’m trying to do a program to compare the BER of QPSK, 16QAM and 64QAM because they’re used in LTE, so I’m planning to use just Rayleigh channel, MIMO 2×2 and 4×4. When I tried to use QAM in a Rayleigh channel my curve became linear, and it’s wrong. Do you have a simulation like I said. Thank you so much, your programs helped me a lot.

Krishna Sankar March 21, 2013 at 6:23 am

@Italo: Please check out the post discussing Symbol error rate of some higher order modulation schemes like 16qam, 64qam etc
http://www.dsplog.com/2012/01/01/symbol-error-rate-16qam-64qam-256qam/

Malaz March 12, 2013 at 6:06 pm

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 ?

Malaz March 12, 2013 at 6:24 pm

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 ?

Krishna Sankar March 13, 2013 at 5:29 am

@Malaz: In the alamouti scheme, we assume that the channel is constant for two symbols.

Krishna Sankar March 13, 2013 at 5:28 am

@Malaz: Are you getting zero BER when no noise is added?

bouhafs February 10, 2013 at 10:18 pm

Krishna Sankar February 15, 2013 at 4:04 am

@bouhafs: to convert this to QPSK, make the transmission on imaginary part too.

kajal February 1, 2013 at 3:25 pm

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??

Krishna Sankar February 5, 2013 at 5:37 am
TAN January 13, 2013 at 6:46 pm

hi!
thanks for all
i want simolation for MIMO STBC.
DO YOU HELP ME?

Krishna Sankar January 17, 2013 at 5:32 am

@TAN: For some posts on MIMO please checkout
http://www.dsplog.com/category/mimo/

Sham December 7, 2012 at 8:15 pm

Nice work.
Can we apply convolutional code (or any error-correcting code) to this STBC??

Krishna Sankar December 8, 2012 at 3:53 am

@Sham: Yes, should be possible. One of the mode in 802.11n has convolutional code + STBC

shona November 8, 2012 at 12:20 pm

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

% 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;
% 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
%
%

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

ii = i;
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'.

Krishna Sankar November 12, 2012 at 7:01 am

@shona: You were using matlab for simulations?

Krishna Sankar November 2, 2012 at 6:36 am

hamad October 12, 2012 at 7:07 pm

thank you very much for your simulation.
help me for stbc ofdm

Krishna Sankar October 17, 2012 at 6:19 am

shona October 8, 2012 at 6:16 pm

sir i need a code for video transmission..plz held me out asap

shona October 2, 2012 at 8:52 pm

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…

Krishna Sankar October 5, 2012 at 5:04 am

@shona: Most of the articles in this blog assume a random binary data and use the underlying communication pipe to communicate. For some more articles tagged under MIMO, please check out
http://www.dsplog.com/category/mimo/

charishma September 30, 2012 at 12:34 pm

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

Krishna Sankar October 5, 2012 at 5:18 am

@charishma: Since I did not want to have any for loops in the code, was playing with the vector (and forming a matrix) to model the alamouti stbc coding

Olga August 25, 2012 at 3:55 pm

Hello, Krishna!

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

Krishna Sankar August 29, 2012 at 5:20 am

@Olga: No, I did not..

Fadil July 9, 2012 at 7:20 pm

hi Krishna
thank you for this information

taral patel July 8, 2012 at 10:17 am

how to measure spectral efficiency bit/hz/sec in stbc 2×1 system

Krishna Sankar July 10, 2012 at 6:01 am

@taral : the 2×1 stbc code does not change the data rate

piyush July 8, 2012 at 7:48 am

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?

Krishna Sankar July 10, 2012 at 5:45 am

@piyush: same frequency. the interference between the two symbols does not impact because the code is orthogonal.

Ahmad July 7, 2012 at 2:19 pm

How can i use this STBC with OFDM transmission? Do u have any script for that?

Krishna Sankar July 10, 2012 at 5:42 am

@Ahmad: Using scripts provided in http://www.dsplog.com/tag/ofdm as reference, one should be able to build a STBC code/decode on top of it. Please try.

Ahmad July 10, 2012 at 11:43 am

I’m trying now, Thanks

ajit virunath July 7, 2012 at 9:36 am

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

Krishna Sankar July 10, 2012 at 5:40 am

@ajith: i have not written on jakes channel model on dsplog.com

piyush July 7, 2012 at 9:28 am

sir your replay very fast ,such nice help
thank sir

piyush July 7, 2012 at 9:03 am

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

Krishna Sankar July 10, 2012 at 5:37 am

@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.

piyush July 6, 2012 at 9:08 am

which IEEE standard use stbc ?

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

Krishna Sankar July 7, 2012 at 5:40 am

@piyush: ieee 802.11n, lte defines STBC in the PHY layer specification

AMINE August 21, 2014 at 11:58 pm

IEEE 802.16 too but it’s optional for both

piyush July 6, 2012 at 8:56 am

stbc transmit symbol x1 ,x2 so they use same frequency or different?

Krishna Sankar July 7, 2012 at 5:40 am

@piyush: hmm… same frequency. why do you think frequency is different?

piyush July 7, 2012 at 9:00 am

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

Krishna Sankar July 10, 2012 at 5:32 am

@piyush: hmm… the splitting between audio/video traffic is done at higher layer (possibly MAC layer)

PIYUSH August 2, 2012 at 8:52 am

mens i have transmit different information mens x1 audio and x2 video?

piyush July 5, 2012 at 5:04 pm

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

Krishna Sankar July 6, 2012 at 5:48 am

@piyush: though ‘ve not closely looked at the math, but should be possible as long as you ensure that the channel is orthogonal.

MFS June 6, 2012 at 3:43 pm

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

Krishna Sankar June 11, 2012 at 5:09 am

@MFS: You can try a raised cosine filter
http://www.dsplog.com/tag/pulse-shaping/

hamza altheny June 5, 2012 at 2:32 pm

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

Krishna Sankar June 11, 2012 at 5:22 am

@hamza: I reckon this simulation model is using ideal channel estimates at the receiver.

Ali May 24, 2012 at 1:54 am

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

Krishna Sankar June 11, 2012 at 5:30 am

@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* ....]

sachin May 8, 2012 at 11:52 pm

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.

Krishna Sankar May 15, 2012 at 5:35 am

@sachin: sorry, i have not tried ostbc

osama May 6, 2012 at 11:59 pm

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

Krishna Sankar May 8, 2012 at 5:24 am

@osama: Which is the code used in 3×1 STBC?

osama May 8, 2012 at 10:39 am

i see some results in mimo show that 2×1 alamouti better than 3×1 stbc.

Krishna Sankar May 15, 2012 at 5:34 am

@osama: what is the coding used for 3×1 case?

Venkatraman April 27, 2012 at 7:45 pm

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.

Krishna Sankar May 2, 2012 at 4:51 am

@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

osama April 24, 2012 at 11:38 am

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

Krishna Sankar April 26, 2012 at 5:48 am

@osama: The scaling by 1/sqrt(Tx) is required to do a ‘fair’ comparison – i.e. make the transmit power unity.

Tuấn April 16, 2012 at 8:36 am

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?

Krishna Sankar April 17, 2012 at 4:26 am

@Tuấn: I think Alamouti STBC + OFDM is used in the recent wireless standards like 802.11n, 802.11ac, LTE

osama March 31, 2012 at 8:44 pm

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

Krishna Sankar April 2, 2012 at 5:19 am

@osama: One can scale by a factor of 1/sqrt(nTx) ?

osama April 2, 2012 at 1:35 pm

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

Krishna Sankar April 3, 2012 at 3:47 am

@osama: When you are moving from 3 Tx antenna to 4, are you repeating the same information of the new antenna?

John March 18, 2012 at 7:47 am

This is very helpful. Thank you very much!
Good luck!

Md. Mejbaul Haque March 14, 2012 at 3:35 pm

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.

Krishna Sankar March 21, 2012 at 5:10 am

@Mejbaul: Sorry, I do not have the equation handy. Need to refer the text books.

Md. Mejbaul Haque March 13, 2012 at 9:22 pm

Dear Sir I need a generalized code to simulate the MIMO OFDM system such as 2*2,3*3,4*4, etc.. Please work on the topic to help me.

Krishna Sankar March 21, 2012 at 5:11 am

@Mejbaul : Please take a look at http://www.dsplog.com/tag/mimo

avinash March 13, 2012 at 4:53 pm

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?

Krishna Sankar March 21, 2012 at 5:11 am

@avinash: What’s the difference between 4-QAM and QPSK?

mariam March 11, 2012 at 9:28 pm

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.

Krishna Sankar March 12, 2012 at 4:40 am

@mariam: I have not tried simulating that paper.

suthiksha January 12, 2012 at 11:15 am

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

Krishna Sankar January 14, 2012 at 6:56 am

@suthiksha: Sorry, I do not have any code handy

kelvin December 17, 2011 at 3:32 pm

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 !!

Krishna Sankar January 4, 2012 at 5:45 am

@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

Ahmet May 23, 2011 at 5:23 am

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….

Krishna Sankar May 24, 2011 at 5:15 am

@Ahmet: It should be reasonably simple to mix OFDM with STBC. Hope the post on BER for BPSK with OFDM modulation helps
http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/

vn May 21, 2011 at 7:40 am

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,

Krishna Sankar May 23, 2011 at 2:10 am

@vn: Well, I have not discussed the derivation of the BER of Alamouti STBC. Something to add to the TODO bucket.

emma May 21, 2011 at 1:07 am

Dear Krishna, do you have any advice of how to implement in time domain STBC.

Krishna Sankar May 23, 2011 at 2:24 am

@emma: Well, the same idea should hold good.

yogender singh gill May 14, 2011 at 4:36 pm

hi,can i get the matlab code for spatial multiplexing

Krishna Sankar May 24, 2011 at 5:16 am

@yogender: You can refer to a 2×2 MIMO simulation case with Zero Forcing equalizer
http://www.dsplog.com/2008/10/24/mimo-zero-forcing/

ahmed May 13, 2011 at 12:24 am

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 ?

Krishna Sankar May 24, 2011 at 5:17 am

@Ahmed: It should be reasonably simple to mix OFDM with STBC. Hope the post on BER for BPSK with OFDM modulation helps
http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/

ahmed May 12, 2011 at 10:24 pm

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

Krishna Sankar May 24, 2011 at 5:18 am

@Ahmed: It should be reasonably simple to mix OFDM with diversity. Put the symbols on each subcarriers.
Hope the post on BER for BPSK with OFDM modulation helps – http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/

Nabeel Ahmad March 23, 2011 at 3:00 am

Thanx..Its A good Effort ..

kalpana March 5, 2011 at 4:48 pm

hii…why r u not posting any articles related to dsp these days????

Krishna Sankar May 26, 2011 at 5:56 am

@kalpana: being a bit lazy. trying to come back… .:)

abdallah November 16, 2010 at 8:30 am

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 ,

Krishna Sankar November 17, 2010 at 5:01 am

@abdallah: Sorry, I did not understand your query.

abdallah November 18, 2010 at 1:27 am

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));

Krishna Sankar November 18, 2010 at 4:25 am

@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?

deep November 16, 2010 at 8:27 am

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

Krishna Sankar November 17, 2010 at 5:01 am

@deep: Sorry, I did not understand your query.

metios June 17, 2010 at 7:14 pm

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);

Krishna Sankar June 21, 2010 at 5:04 am

@metios: What is the distribution of the interference? Gaussian?

Maduranga June 17, 2010 at 12:29 pm

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.

Krishna Sankar June 21, 2010 at 5:10 am

@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

http://www.dsplog.com/2009/04/13/transmit-beamforming/

metios June 12, 2010 at 8:15 pm

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

Krishna Sankar June 14, 2010 at 6:08 am

@metios: Plz refer the example code in this post for reference.

Mohammad Jarrah June 12, 2010 at 4:32 am

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

made by Vahid Tarokh and Hamid Jafarkhani.

Krishna Sankar June 14, 2010 at 6:15 am

@Mohammad Jarrah: Sorry, I have not tried simulating that paper.

fhuang May 26, 2010 at 6:54 am

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?

Krishna Sankar June 24, 2010 at 4:09 am

@fhuang: Transmitting the same signal from both the antennas does not help to improve diversity. I have discussed this briefly in the post
http://www.dsplog.com/2009/04/13/transmit-beamforming/

Mohammad April 27, 2010 at 2:45 am

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??

Krishna Sankar April 27, 2010 at 4:52 am

@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.

sahinna April 26, 2010 at 2:00 pm

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.

Krishna Sankar April 27, 2010 at 4:55 am

@sahinna: Though I have not discussed QAM with STBC case, you can use posts on symbol error rate/bit error rate for 16QAM in AWGN case as a reference
http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/
http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/

chokoba April 24, 2010 at 9:00 pm

I always thank you for your blog.
It helps me.
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)’);

chokoba April 25, 2010 at 1:58 pm

I solved the problem^^

Krishna Sankar April 26, 2010 at 6:22 am

@chokoba: Sorry, I did not look deeply into the code. Are you getting zero error when the noise is forced to 0?

Mohammad April 24, 2010 at 8:05 pm

dear K. Pillali

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

Krishna Sankar April 26, 2010 at 6:27 am

@Mohammad: The factor 1/20 is because, its a voltage scaling factor.

Mohammad April 26, 2010 at 7:58 pm

ok thanx

sahinna April 12, 2010 at 3:43 am

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

Krishna Sankar April 14, 2010 at 5:07 am

@sahinna: Sorry, I wont be able to do Matlab coding for you. However, if you ask queries, I can reply

Jamil March 19, 2010 at 4:27 am

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))?

Krishna Sankar March 28, 2010 at 2:16 pm

@Jamil: Since we are sending the same information ‘twice’, we need to normalize the transmit power to unity. Hence the scaling factor by 1/sqrt(2)

khushi August 17, 2012 at 3:58 pm

@ Krishna
sir please tell me what is the meaning of these syntax:
1. sCode(:,1:2:end)
2. sCode(:,2:2:end)

Krishna Sankar August 29, 2012 at 5:53 am

@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

Mohammad March 10, 2010 at 4:00 am

Dear Mr. Krishna;

thanx for this golden code.
How the code should be changed???

Krishna Sankar March 29, 2010 at 6:44 am

Mohammad April 16, 2010 at 9:33 pm

thanx Mr. Krishna.

dont worry, i think Matlab don’t include Nakagami simulation

eman February 26, 2010 at 11:59 pm

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

Krishna Sankar March 30, 2010 at 5:29 am

@eman: You can define a threshold and based on that threshold find the false alarm and missed detection probability.

manoj sharma February 9, 2010 at 7:04 am

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

Krishna Sankar April 4, 2010 at 4:13 am
manoj sharma February 9, 2010 at 7:00 am

hi a nice web site

Krishna Sankar April 4, 2010 at 4:14 am

@manoj sharma: Thanks

Alex January 8, 2010 at 12:58 pm

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

wap January 2, 2010 at 6:31 pm

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??

Abrar December 16, 2009 at 2:29 am

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

Krishna Sankar December 22, 2009 at 5:59 am

@Abrar: Yes, you are right

KimMyungsong December 14, 2009 at 12:06 pm

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**********************************************************
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;

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
%
%

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

m2=ml./2;

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
%
%

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 ***************************

Krishna Sankar December 22, 2009 at 5:43 am

@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.

KimMyungsong January 27, 2010 at 7:34 am

I already solved, thanks a lot.

Just need to delete below line.
%yHat(2:2:end) = conj(yHat(2:2:end));

Krishna Sankar January 28, 2010 at 5:32 am

nikunj December 4, 2009 at 12:17 pm

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???

Krishna Sankar December 7, 2009 at 5:12 am

@nikunj: Well, as I do not have pskdemod() function, I cannot comment. You might want to have a look @
http://www.dsplog.com/2008/03/18/symbol-error-rate-for-16psk/

joel November 16, 2009 at 9:24 pm

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 !

Krishna Sankar December 6, 2009 at 3:38 pm

@joel: Thanks for the close review. I corrected both the typos.

Rory November 15, 2009 at 8:02 pm

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.

Krishna Sankar December 3, 2009 at 5:42 am

@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?

balu October 4, 2009 at 2:24 pm

hi krishna,
do u have matlab code for qrd-m algorithm in mimo-ofdm systems , if so plz help me.
thank u.

Krishna Sankar October 8, 2009 at 5:21 am

@balu: Sorry, no.

Aditya October 4, 2009 at 9:54 am

Hi Krishna,

Thanks for sharing the information. The website and all its articles are very informative….

Krishna Sankar October 8, 2009 at 5:21 am

surender September 15, 2009 at 6:12 am

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…………….

Krishna Sankar September 18, 2009 at 5:37 am

@surender: I have discussed couple of posts on 16QAM modulation
http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/
http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/
Hope you will be able to adapt those to Alamouti case.

Sivam September 5, 2009 at 12:46 pm

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!

Krishna Sankar September 9, 2009 at 5:42 am

@Sivam: The equation is same as the theoretical equation for BER for Maximal Ratio Combining, but poorer by 3dB. You can find the post on Maximal Ratio Combining @
http://www.dsplog.com/2008/09/28/maximal-ratio-combining/

Sivam September 4, 2009 at 6:59 am

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;

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));

Krishna Sankar September 9, 2009 at 5:37 am

@Sivam: I guess changing only the variable s and the receiver ipHat should suffice.

sam September 1, 2009 at 10:38 am

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

Krishna Sankar September 7, 2009 at 5:36 am

@sam: I have discussed 2 transmit – 1 receive alamouti and 2 transmit – 2 receive alamouti codes. In future, I might consider discussing other structures which you have proposed.

I have one post on Selection diversity @

Excellsun May 12, 2011 at 3:01 am

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.

Krishna Sankar May 24, 2011 at 5:19 am

@Excellsun: Will add that to the TODO list

mak_m August 29, 2009 at 4:30 am

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

Krishna Sankar September 7, 2009 at 5:18 am

@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.

mohammad August 26, 2009 at 11:06 am

hi Krishna
My theses in MIMO in WIMMAX ,plz give me an idea for simulation.
Best regards.

Krishna Sankar September 7, 2009 at 4:58 am

@mohammad: Which blocks are you planning to simulate? Good luck.

sreenu August 24, 2009 at 4:41 pm

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.

Krishna Sankar August 30, 2009 at 10:52 am

@sreenu: what is CI-OFDM?

sreenu September 12, 2009 at 8:31 pm

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

Krishna Sankar September 14, 2009 at 5:29 am

@sreenu: Whats the advantage in having such a scheme? and where is this used?

sreenu September 22, 2009 at 4:02 pm

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.

surbhi August 13, 2009 at 12:13 pm

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.

Krishna Sankar August 14, 2009 at 5:08 am

@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.

Umesh Bhaskar August 5, 2009 at 4:05 pm

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

Krishna Sankar August 10, 2009 at 5:47 am

WiMAX February 17, 2010 at 3:35 am

Krishna Sankar April 4, 2010 at 3:51 am

@WiMAX: Yes

Mahdi July 29, 2009 at 6:18 pm

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

Krishna Sankar July 30, 2009 at 5:39 am

@Mahdi: Did you mean threshold for determining whether the received symbol corresponds to 1 or 0? Yes, there is.

mohanad July 24, 2009 at 5:38 pm

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

Krishna Pillai July 28, 2009 at 4:28 am

@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

mohanad July 21, 2009 at 9:24 pm

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.
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)))
xlabel(‘time (s)’)
ylabel(‘Magnitude of E Field (dB)’)

Krishna Pillai July 24, 2009 at 4:08 am

@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.

Khattak July 6, 2009 at 8:43 pm

Exellent theory and simulation i found kit useful.

Krishna Pillai July 15, 2009 at 4:36 am

pofi July 2, 2009 at 5:49 pm

but why do we use alamoutis STBC? what ist actually the advantage of if?

chadi June 20, 2009 at 4:07 pm

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

Krishna Pillai June 21, 2009 at 12:58 pm

Phan Minh Hoang May 23, 2009 at 6:12 am

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

Krishna Pillai May 31, 2009 at 8:06 pm

@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.

fof May 22, 2009 at 1:19 am

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));

Krishna Pillai May 22, 2009 at 5:30 am

@fof: Sorry. But, what is the error which you are observing?

fof May 22, 2009 at 1:06 pm

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….

fof May 20, 2009 at 5:08 pm

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…

SAEED May 18, 2009 at 10:50 am

plz krishna;
give me another one matlab code to find ber/snr for 1tx-1rx & 2tx-1rx(alamouti)

Krishna Pillai May 20, 2009 at 5:43 am

@SAEED: The 1 transmit 1 receive case is discussed in the post
http://www.dsplog.com/2008/08/10/ber-bpsk-rayleigh-channel/

gly May 17, 2009 at 5:56 pm

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!

Krishna Pillai May 20, 2009 at 5:32 am

@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
http://www.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.

UP April 26, 2009 at 12:43 am

@ 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!!!

Krishna Pillai April 30, 2009 at 5:21 am

@UP: Recalling the results from QPSK results in AWGN, the BER vs Eb/N0 curve is identical for both QPSK and BPSK. So, I do not see the reason for 6dB difference.

R@juelo April 16, 2009 at 7:56 pm

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

Krishna Pillai April 18, 2009 at 8:14 am

@R@juelo: Sorry, I have not tried modeling the channel correlation case.

sara April 12, 2009 at 10:15 pm

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

Krishna Pillai April 16, 2009 at 5:37 am

@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.

abubaker April 12, 2009 at 5:01 pm

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

UP April 12, 2009 at 5:26 am

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!

UP April 12, 2009 at 9:10 am

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!

Krishna Pillai April 16, 2009 at 5:33 am

@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).

Krishna Pillai April 16, 2009 at 5:29 am

@UP: Well, thats surprising. Are you scaling the transmit power accordingly?

UP April 17, 2009 at 4:18 am

Hi , Could you please tell me by what factor should I scale the transmit power ?

Krishna Pillai April 18, 2009 at 8:09 am

@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.

UP April 11, 2009 at 3:59 am

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 ?

Krishna Pillai April 11, 2009 at 7:54 am

@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?

gly April 8, 2009 at 1:41 pm

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!

Krishna Pillai April 11, 2009 at 7:02 am

@gly: Sorry, I do not have Simulink

abubaker April 7, 2009 at 4:58 pm

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 ..

Krishna Pillai April 11, 2009 at 6:35 am

@abubaker: Sorry, I have not studied the effect of channel correlation in MRC and alamouti. From a quick googling, found that the link http://www.comm.utoronto.ca/~rsadve/Notes/DiversityReceive.pdf discuss about correlation for MRC.

Please also do reply to the comment, if you find more pertinent literature.

abubaker April 11, 2009 at 5:30 pm

hi krishna thanks for your reply..this is link..http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=04109656..ieee paper with title “Symbol Error Probability for Space–Time Block Codes over Spatially Correlated Rayleigh Fading Channels” thsis gives the equations for alamouti scheme for all psks annd qams…

Krishna Pillai April 12, 2009 at 7:02 am

@abubaker: Thanks

abubaker April 12, 2009 at 4:41 pm

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.

hannah April 6, 2009 at 5:51 pm

hi krishna,
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?
Thanks very much.

Krishna Pillai April 11, 2009 at 6:17 am

@hannah: The Matlab model provided in this post can be easily adapted to QPSK case. Good luck in your project.

abubaker April 11, 2009 at 5:33 pm

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

Krishna Pillai April 16, 2009 at 5:22 am

@abubaker: Well, the symbol error rate for QPSK is around 3dB poorer than that for BPSK. However the BER performance is the same. Please refer to the following post for bit more details
http://www.dsplog.com/2008/07/08/compare-bpsk-qpsk-4pam-16qam-16psk-64qam-32psk/

SHMAA April 1, 2009 at 11:12 am

great job krishna i hope you continue you’r
devolopment of alamouti……..

Krishna Pillai April 4, 2009 at 4:43 pm

@SHMAA: Thanks. I wrote a follow up post on 2 transmit 2 receive alamouti STBC @

DRAM March 12, 2009 at 10:44 pm

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

Krishna Pillai March 21, 2009 at 7:26 am

@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.

Murali February 27, 2009 at 9:42 am

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

Krishna Pillai March 5, 2009 at 4:18 am

@Murali: Sorry, I have not worked on QOSTBC

Murali February 27, 2009 at 9:39 am

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

Krishna Pillai March 5, 2009 at 4:18 am

@Murali: Hmm… I have not worked on COSTBC.
For BPSK modulation in flat Rayleigh channel, you may look up @
http://www.dsplog.com/2008/08/10/ber-bpsk-rayleigh-channel/
For QPSK in AWGN, you may look up @
http://www.dsplog.com/2007/11/06/symbol-error-rate-for-4-qam/

Hope this helps.

Arun February 12, 2009 at 11:14 am

hi..can we combine OFDM with Alamouti forming STF code..i am not getting pls can u suggest code if possible

Krishna Pillai February 19, 2009 at 6:01 am

@Yes we can. However, I have not written posts on it. Just picked up a URL from googling
http://www.mk.tu-berlin.de/mitarbeiter/tub/lehrbeauftragte/intro_stc-sfc-coding

lia February 10, 2009 at 5:30 am

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

Jose C February 11, 2009 at 12:09 am

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”

Suchitra February 9, 2009 at 1:02 pm

hi krishna…
please suggest me code for Alamouti with OFDM…

Krishna Pillai February 10, 2009 at 8:09 pm

@Suchitra: Please refer to the post on
http://www.dsplog.com/2008/10/16/alamouti-stbc/

Krishna Pillai February 10, 2009 at 8:09 pm

@Suchitra: Please refer to the post on
http://www.dsplog.com/2008/10/16/alamouti-stbc/

giri February 5, 2009 at 9:06 pm

Can you explain what is IRC. In LTE there is mention of IRC.

Krishna Pillai February 10, 2009 at 7:48 pm

@giri: Sorry. Studying LTE spec is in my to-do list for a while. Hope to do it soon.

Rocco January 30, 2009 at 3:25 pm

Hello Krishna,

your explanation is very clear and really helped me a lot.

Thank you

Krishna Pillai January 31, 2009 at 6:40 am

@Rocco: Thanks

lia January 29, 2009 at 3:33 pm

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);

Krishna Pillai January 30, 2009 at 5:52 am

@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.

Paul January 28, 2009 at 8:01 pm

Thank you so much Krishna

Paul January 27, 2009 at 10:15 am

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

Krishna Pillai January 28, 2009 at 6:01 am

@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.

Krishna Pillai November 21, 2008 at 5:46 am

@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.

farie November 19, 2008 at 5:45 pm

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.

Krishna Pillai November 5, 2008 at 5:43 am

@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}.

Alvina November 4, 2008 at 12:55 am

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,

Alvina November 3, 2008 at 9:16 pm

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,

Alvina November 3, 2008 at 9:05 pm

Hi krishna

can u tell plz why you h

Krishna Pillai October 31, 2008 at 6:02 am

@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.

ila October 29, 2008 at 9:54 pm

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

ila October 29, 2008 at 9:19 pm

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*]

Krishna Pillai October 24, 2008 at 6:45 pm

@Honghai , @Mercy: Hope the recent post on 2×2 MIMO with Zero forcing equalisation (for BPSK in Rayleigh channel) helps.
URI: http://www.dsplog.com/2008/10/24/mimo-zero-forcing/

Mercy October 19, 2008 at 7:16 pm

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

Mercy October 19, 2008 at 7:13 pm

thanks for t heinfo… I cant for posts on MIMO.

Honghai October 17, 2008 at 10:55 pm

Krishna Pillai October 17, 2008 at 10:18 pm

Alvina October 17, 2008 at 1:54 pm

well explained.

Krishna Pillai April 16, 2009 at 5:34 am

@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.

fof May 19, 2009 at 1:09 am

i need it to be with Maximum Likelihood Detection for Alamouti-STBC system Under QPSK modulation condition….not with hard decision….so can you help me please…

Krishna Sankar October 1, 2009 at 5:08 am

@sreenu: Thanks. Can you plz point me to articles on the net or in print.