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

## Alamouti STBC

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

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

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

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

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

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

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

## Other Assumptions

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

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

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

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

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

with and .

7. The channel is known at the receiver.

## Receiver with Alamouti STBC

In the first time slot, the received signal is,

.

In the second time slot, the received signal is,

.

where

, is the received symbol on the first and second time slot respectively,

is the channel from transmit antenna to receive antenna,

is the channel from transmit antenna to receive antenna,

, are the transmitted symbols and

is the noise on time slots.

Since the two noise terms are independent and identically distributed,

.

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

.

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

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

.

The term,

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

.

The estimate of the transmitted symbol is,

.

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

## BER with Almouti STBC

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

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

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

, where

.

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

and **Bit Error Rate is**

.

## Key points

The fact that is a diagonal matrix ensured the following:

1. There is no cross talk between , after the equalizer.

2. The noise term is still white.

.

## Simulation Model

The Matlab/Octave script performs the following

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

(b) Group them into pair of two symbols

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

(d) Equalize the received symbols

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

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

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

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

**Observations**

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

## Reference

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

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

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

{ 299 comments… read them below or add one }

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

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

ไหมละน้อ เว้บหนังใหม่ๆ

อัพเดรตทุกวันทุ 24 ชม.

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

ไม่เชื่อเท่าไร ชอบหนังเราไหม ชอบๆ กำลังพาเราหาดูหนัง

หนังสนุกๆ

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 .

It really is now known that pressure, sunlight, That is where the word

‘chilly sore’ grew to be descriptive of the infection.

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…

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

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.

The consultants present automation to your garage doorways

and other doors.

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.

Right here is the right website for anybody who really

wants to find out about this topic. You understand

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!

Create a exercise schedule. Blot your pizza. Read on!

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

some additional information.

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!

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!

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

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.

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.

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.

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

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

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

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

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

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

plz help me,

@jyothi: please checkout http://www.dsplog.com/tag/alamouti/

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.

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.

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

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 ?

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 ?

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

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

i need a programme of alamouti with 4-QAM MODULATION ?please help me

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

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

@kajal: please check out the post

http://www.dsplog.com/2009/04/21/six-equalizers-for-v-blast/

hi!

thanks for all

i want simolation for MIMO STBC.

DO YOU HELP ME?

@TAN: For some posts on MIMO please checkout

http://www.dsplog.com/category/mimo/

Nice work.

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

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

i am working on the video transmission project..but um geeting an error in dis…i hope you can figure it out..

function mpegproj

% MPEG-2 style coding. This function will get a movie, encode

% it, decode it, and write the MPEG data and both movie versions to disk

% for later playback.

fprintf(‘\nMPEG Project\n’)

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

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

mov = getmov(nf);

tic

mpeg = encmov(mov);

fprintf(‘Encode time: %s\n’,sec2timestr(toc))

tic

mov2 = decmpeg(mpeg);

fprintf(‘Decode time: %s\n’,sec2timestr(toc))

save lastmov mov mpeg mov2

%%

function movdata = getmov(nf)

% Choose the movie to process. Each movie must be saved to disk in a .mat

% file. The .mat file should contain a variable named ‘mov’ that is a

% MATLAB movie.

%

% See loadFileYuv and loadFileY4m for help converting movies from YUV and

% Y4M format to MATLAB movies.

% Movie files & number of frames

%

% bus 150

% carphone 382

% tempete2 260

% husky 250

% akiyo 300 @ 60 fps

% foreman 300

% hall_monitor 300 @ 60 fps

% mobile 300 @ 60 fps

load bus

% load carphone

% load tempete2

% load mobile

% load hall_monitor

% load husky

% Movie is RGB, so get 4-D array (height, width, color component, frame #)

if nf == 0

nf = length(mov);

end

movdata = repmat(uint8(0),[size(mov(1).cdata), nf]);

for i = 1:nf

movdata(:,:,:,i) = mov(i).cdata;

end

%%

function mpeg = encmov(mov)

% Frame type pattern (repeats for entire movie)

fpat = ‘IPPPP’; % Custom

% fpat = ‘I’; % All I frames

% fpat = ['I', repmat('P',1,size(mov,4))]; % All P frames (except #1)

% Loop over frames

k = 0;

pf = [];

progressbar

for i = 1:size(mov,4)

% Get frame

f = double(mov(:,:,:,i));

% Convert frame to YCrCb

f = rgb2ycc(f);

% Get frame type

k = k + 1;

if k > length(fpat)

k = 1;

end

ftype = fpat(k);

% Encode frame

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

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

end

%%

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

[M,N,i] = size(f);

mbsize = [M, N] / 16;

mpeg = struct(‘type’,[],’mvx’,[],’mvy’,[],’scale’,[],’coef’,[]);

mpeg(mbsize(1),mbsize(2)).type = [];

% Loop over macroblocks

pfy = pf(:,:,1);

df = zeros(size(f));

for m = 1:mbsize(1)

for n = 1:mbsize(2)

% Encode one macroblock

x = 16*(m-1)+1 : 16*(m-1)+16;

y = 16*(n-1)+1 : 16*(n-1)+16;

[mpeg(m,n),df(x,y,:)] = encmacroblock(f(x,y,:),ftype,pf,pfy,x,y);

end % macroblock loop

end % macroblock loop

%%

function b = getblocks(mb)

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

% Four lum blocks

b(:,:,1) = mb( 1:8, 1:8, 1);

b(:,:,2) = mb( 1:8, 9:16, 1);

b(:,:,3) = mb( 9:16, 1:8, 1);

b(:,:,4) = mb( 9:16, 9:16, 1);

% Two subsampled chrom blocks (mean of four neighbors)

b(:,:,5) = 0.25 * ( mb(1:2:15,1:2:15, 2) + mb(1:2:15,2:2:16, 2) …

+ mb(2:2:16,1:2:15, 2) + mb(2:2:16,2:2:16, 2) );

b(:,:,6) = 0.25 * ( mb(1:2:15,1:2:15, 3) + mb(1:2:15,2:2:16, 3) …

+ mb(2:2:16,1:2:15, 3) + mb(2:2:16,2:2:16, 3) );

%%

function ycc = rgb2ycc(rgb)

% Transformation matrix

m = [ 0.299 0.587 0.144;

-0.168736 -0.331264 0.5;

0.5 -0.418688 -0.081312];

% Get movie data

[nr,nc,c] = size(rgb);

% Reshape for matrix multiply

rgb = reshape(rgb,nr*nc,3);

% Transform color coding

ycc = m * rgb’;

ycc = ycc + repmat([0; 0.5; 0.5],1,nr*nc);

% Reshape to original size

ycc = reshape(ycc’,nr,nc,3);

%%

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

% Coeff quantization matrices

persistent q1 q2

if isempty(q1)

q1 = qintra;

q2 = qinter;

end

% Quality scaling

scale = 31;

% Init mpeg struct

mpeg.type = ‘I’;

mpeg.mvx = 0;

mpeg.mvy = 0;

% Find motion vectors

if ftype == ‘P’

mpeg.type = ‘P’;

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

mb = emb; % Set macroblock to error for encoding

q = q2;

else

q = q1;

end

% Get lum and chrom blocks

b = getblocks(mb);

% Encode blocks

for i = 6:-1:1

mpeg.scale(i) = scale;

coef = dct2(b(:,:,i));

mpeg.coef(:,:,i) = round( 8 * coef ./ (scale * q) );

end

% Decode this macroblock for reference by a future P frame

dmb = decmacroblock(mpeg,pf,x,y);

%%

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

% Do search in Y only

mby = mb(:,:,1);

[M,N] = size(pfy);

% % Exhaustive search

% maxstep = 10; % Largest allowable motion vector in x and y

%

% mvxv = -maxstep:maxstep;

% mvyv = -maxstep:maxstep;

% minsad = inf;

% for i = 1:length(mvxv)

%

% tx = x + mvxv(i);

% if (tx(1) < 1) | (M < tx(end))

% continue

% end

%

% for j = 1:length(mvyv)

%

% ty = y + mvyv(j);

% if (ty(1) < 1) | (N < ty(end))

% continue

% end

%

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

%

% if sad = 1

minsad = inf;

for i = 1:length(dx)

tx = x + mvx + dx(i)*step;

if (tx(1) < 1) || (M < tx(end))

continue

end

ty = y + mvy + dy(i)*step;

if (ty(1) < 1) || (N < ty(end))

continue

end

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

if sad < minsad

ii = i;

minsad = sad;

end

end

mvx = mvx + dx(ii)*step;

mvy = mvy + dy(ii)*step;

step = step / 2;

end

mpeg.mvx = mvx; % Store motion vectors

mpeg.mvy = mvy;

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

%%

function mov = decmpeg(mpeg)

movsize = size(mpeg{1});

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

% Loop over frames

pf = [];

for i = 1:length(mpeg)

% Decode frame

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

% Cache previous frame

pf = f;

% Convert frame to RGB

f = ycc2rgb(f);

% Make sure movie is in 8 bit range

f = min( max(f,0), 255);

% Store frame

mov(:,:,:,i) = uint8(f);

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

end

%%

function fr = decframe(mpeg,pf)

mbsize = size(mpeg);

M = 16 * mbsize(1);

N = 16 * mbsize(2);

% Loop over macroblocks

fr = zeros(M,N,3);

for m = 1:mbsize(1)

for n = 1:mbsize(2)

% Construct frame

x = 16*(m-1)+1 : 16*(m-1)+16;

y = 16*(n-1)+1 : 16*(n-1)+16;

fr(x,y,:) = decmacroblock(mpeg(m,n),pf,x,y);

end % macroblock loop

end % macroblock loop

%%

function mb = putblocks(b)

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

% Four lum blocks

mb( 1:8, 1:8, 1) = b(:,:,1);

mb( 1:8, 9:16, 1) = b(:,:,2);

mb( 9:16, 1:8, 1) = b(:,:,3);

mb( 9:16, 9:16, 1) = b(:,:,4);

% Two subsampled chrom blocks

z = [1 1; 1 1];

mb(:,:,2) = kron(b(:,:,5),z);

mb(:,:,3) = kron(b(:,:,6),z);

%%

function rgb = ycc2rgb(ycc)

% Transformation matrix

m = [ 0.299 0.587 0.144;

-0.168736 -0.331264 0.5;

0.5 -0.418688 -0.081312];

m = inv(m);

% Get movie data

[nr,nc,c] = size(ycc);

% Reshape for matrix multiply

ycc = reshape(ycc,nr*nc,3);

% Transform color coding

rgb = ycc – repmat([0, 0.5, 0.5],nr*nc,1);

rgb = m * rgb';

% Reshape to original size

rgb = reshape(rgb',nr,nc,3);

%%

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

% Coeff quantization matrices

persistent q1 q2

if isempty(q1)

q1 = qintra;

q2 = qinter;

end

mb = zeros(16,16,3);

% Predict with motion vectors

if mpeg.type == 'P'

mb = pf(x+mpeg.mvx,y+mpeg.mvy,:);

q = q2;

else

q = q1;

end

% Decode blocks

for i = 6:-1:1

coef = mpeg.coef(:,:,i) .* (mpeg.scale(i) * q) / 8;

b(:,:,i) = idct2(coef);

end

% Construct macroblock

mb = mb + putblocks(b);

%%

function q = qinter

% Quantization table for P or B frames

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

q = 16;

%%

function q = qintra

% Quantization table for I frames

q = [ 8 16 19 22 26 27 29 34;

16 16 22 24 27 29 34 37;

19 22 26 27 29 34 34 38;

22 22 26 27 29 34 37 40;

22 26 27 29 32 35 40 48;

26 27 29 32 35 40 48 58;

26 27 29 34 38 46 56 69;

27 29 35 38 46 56 69 83 ];

%%

function y = dct2(x)

% Perform 2-D DCT

% Use dctmtx to compute IDCT faster

persistent d

if isempty(d)

d = dctmtx(8);

end

y = d * x * d';

% % DCT is seperable so compute on columns, then on rows

% y = dct(x); % Columns

% y = dct(y')'; % Rows

%%

function y = idct2(x)

% Perform 2-D IDCT

% Use dctmtx to compute IDCT faster

persistent d

if isempty(d)

d = dctmtx(8);

end

y = d' * x * d;

% % DCT is seperable so compute on columns, then on rows

% y = idct(x); % Columns

% y = idct(y')'; % Rows

and the error is….

??? Undefined function or method 'main' for input arguments of type 'char'.

@shona: You were using matlab for simulations?

@ROHIT CHAUDHARY: Please look at Alamouti scheme with two receive antennas at http://www.dsplog.com/2009/03/15/alamouti-stbc-2-receive-antenna/

thank you very much for your simulation.

help me for stbc ofdm

@hamad: For ofdm related posts, please check out http://www.dsplog.com/category/ofdm

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

hello sir….

i need your help regarding my project…

actually i need a mtalab code for video transmission through MIMO…

plzz send me the code as soon as possible…

thnkkzz in advance…

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

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

@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

Hello, Krishna!

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

@Olga: No, I did not..

hi Krishna

thank you for this information

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

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

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?

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

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

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

I’m trying now, Thanks

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

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

please refer http://en.wikipedia.org/wiki/Rayleigh_fading#Jakes.27_model

sir your replay very fast ,such nice help

thank sir

sir to requared orthogonal x1* and x2* are use

but( -)negative sign for -x2* why they use any idea sir?

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

which IEEE standard use stbc ?

STBC is wireless comm. so which layer they work?

MAC or PHY for wireless comm that true sir?

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

IEEE 802.16 too but it’s optional for both

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

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

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

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

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

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

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

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

@MFS: You can try a raised cosine filter

http://www.dsplog.com/tag/pulse-shaping/

please

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

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

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

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

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.

@sachin: sorry, i have not tried ostbc

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

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

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

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

Hello sir,

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

Thanks in advance.

@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

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

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

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?

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

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

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

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

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

This is very helpful. Thank you very much!

Good luck!

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.

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

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.

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

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?

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

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.

@mariam: I have not tried simulating that paper.

hi krishna sir,

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

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

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

@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

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

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

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,

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

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

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

hi,can i get the matlab code for spatial multiplexing

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

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 ?

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

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

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

Thanx..Its A good Effort ..

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

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

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 ,

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

i meant that if you take a look at the paper you will find that for 2TX and 1RX the bit error rate is start at 10^-2 and E\N is around 13

but in the simulation for 2TX and 1RX the bit error start at 10^-1 and the E\N around 24

is this has any effect ?

and you can get the same output in the paper by make some changes in the general formula at the end of simulation and use this formula

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

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

instead of the original one

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

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

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

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

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

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.

@Maduranga: Sending the same signal from both the antennas does not provide any diversity gain.

For eg, consider a 2tx-1rx system having

y = h1x + h2x + n, where

y – is the received symbol

h1 – channel from tx antenna 1 to rx antenna

h2 – channel from tx antenna 2 to rx antenna

x – transmitted symbol

n – noise

The above can be written as

y = (h1+h2)x + n, which kinda gives similar BER performance to y = hx+n case

I have discussed briefly about this @

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

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

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

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

made by Vahid Tarokh and Hamid Jafarkhani.

Please if you could you help me about that?

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

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?

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

Dear Mr. K. Pillali

I want to ask you why did you use

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

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

the same formula for Rayleigh and Gaussian.

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

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

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

Thank you in advance

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

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.

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

I always thank you for your blog.

It helps me.

I remade your code in my way.

I don’t know what is wrong in my code.

Could you correct my code? plz

clear

N = 1000; % number of bits or symbols

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

nErr=zeros(1,length(Eb_N0_dB))

for ii = 1:length(Eb_N0_dB)

% count=0;

for bit=1:N

% Transmitter

ip = rand(1,2)>0.5; % generating 0,1 with equal probability

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

% Alamouti STBC

sCode = (1/sqrt(2))*[s(1) -conj(s(2)); s(2) conj(s(1))];

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

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

% Channel and noise Noise addition

y=sum( sCode.*(kron(h’,[1 1])) ,1) + 10^(-Eb_N0_dB(ii)/20)*n;

yHat=zeros(1,2);

yHat=[conj(h(1))*y(1)+h(2)*conj(y(2)) conj(h(2))*y(1)-h(1)*conj(y(2))];

hPower = h*conj(h’);

ycomb=yHat./hPower;

ipHat = real(ycomb)>0;

% counting the errors

if ip(1) ~= ipHat(1)

nErr(ii)=nErr(ii)+1;

end

if ip(2) ~= ipHat(2)

nErr(ii)=nErr(ii)+1;

end

end

end

simBer = nErr/(2*N); % simulated ber

EbN0Lin = 10.^(Eb_N0_dB/10);

theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));

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

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

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

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

close all

figure

semilogy(Eb_N0_dB,theoryBer_nRx1,’-',’LineWidth’,3);

hold on

% semilogy(Eb_N0_dB,theoryBerMRC_nRx2,’kd-’,'LineWidth’,2);

semilogy(Eb_N0_dB,theoryBerAlamouti_nTx2_nRx1,’g-’,'LineWidth’,3);

semilogy(Eb_N0_dB,simBer,’ro’,'LineWidth’,3);

axis([0 25 10^-5 0.5])

grid on

legend(‘theory (nTx=1,nRx=1)’, ‘theory (nTx=2, nRx=1, Alamouti)’, ‘sim (nTx=2, nRx=1, Alamouti)’);

xlabel(‘Eb/No, dB’);

ylabel(‘Bit Error Rate’);

title(‘BER for BPSK modulation with Alamouti STBC (Rayleigh channel)’);

I solved the problem^^

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

dear K. Pillali

Please, i want o ask you why you used 10^(-Eb_N0_dB(ii)/20)*n in

y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;???????

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

thanx u

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

ok thanx

Hello sir, need your assistance please.

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

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

Hi there,

good day. I could not understand these two lines of your codes.

sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 ...]

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

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

thanks in advance.

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

@ Krishna

sir please tell me what is the meaning of these syntax:

1. sCode(:,1:2:end)

2. sCode(:,2:2:end)

@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

Dear Mr. Krishna;

thanx for this golden code.

but please if we want to reproduce the figures in Nakagami fading channel instead of Rayleigh.

How the code should be changed???

@Mohammad: Sorry, I have not tried modeling Nakagami fading

thanx Mr. Krishna.

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

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

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

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

@manoj sharma: You can refer to some posts on higher order QAM at

http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/

http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/

http://www.dsplog.com/2008/05/24/article-in-dspdesignlinecom-m-qam-symbol-error/

hi a nice web site

@manoj sharma: Thanks

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

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

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

@Abrar: Yes, you are right

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

clear

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

nd = 6; % number of symbols

ml = 2; % modulation levels

para=256; % Number of parallel channel to transmit (points)

N=para*nd; % number of bits or symbols

for ii = 1:length(Eb_N0_dB)

% Transmitter

% ip = rand(1,N)>0.5; % generating 0,1 with equal probability

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

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

% QPSK modulation**********************************************************

paradata = reshape(ip,para,nd*ml);

[ich,qch]=qpskmod(paradata,para,nd,ml);

kmod=1/sqrt(2);

s=(ich+qch.*i).*kmod;

s = reshape(s,1,para*nd);

% IFFT*********************************************************************

% s=ifft(s);

% Alamouti STBC

sCode = zeros(2,N);

sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 ...]

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

% IFFT*********************************************************************

% sCode=ifft(sCode);

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

hMod = kron(reshape(h,2,N/2),ones(1,2)); % repeating the same channel for two symbols

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

% Channel and noise Noise addition

y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;

% Receiver

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

yMod(2,:) = conj(yMod(2,:)); % [y1 y1 ... ; y2* y2*...]

% FFT**********************************************************************

% yMod = fft(yMod);

% forming the equalization matrix

hEq = zeros(2,N);

hEq(:,[1:2:end]) = reshape(h,2,N/2); % [h1 0 ... ; h2 0...]

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

hEq(1,:) = conj(hEq(1,:)); % [h1* h2* ... ; h2 -h1 .... ]

hEqPower = sum(hEq.*conj(hEq),1);

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

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

% receiver – hard decision decoding

% ipHat = real(yHat)>0;

% Hard decision decoding***************************************************

yHat = reshape(yHat,para,nd);

S_re = real(yHat)/kmod;

S_im = imag(yHat)/kmod;

[demodata]=qpskdemod(S_re,S_im,para,nd,ml);

ipHat = reshape(demodata,1,ml*N);

% FFT**********************************************************************

% ipHat = fft(ipHat);

% counting the errors

nErr(ii) = size(find([ip- ipHat]),2);

end

simBer = nErr/(ml*N); % simulated ber

EbN0Lin = 10.^(Eb_N0_dB/10);

theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5));

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

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

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

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

close all

figure

semilogy(Eb_N0_dB,theoryBer_nRx1,’bp-’,'LineWidth’,2);

hold on

semilogy(Eb_N0_dB,theoryBerMRC_nRx2,’kd-’,'LineWidth’,2);

semilogy(Eb_N0_dB,theoryBerAlamouti_nTx2_nRx1,’c+-’,'LineWidth’,2);

semilogy(Eb_N0_dB,simBer,’mo-’,'LineWidth’,2);

axis([0 25 10^-5 0.5])

grid on

legend(‘theory (nTx=1,nRx=1)’, ‘theory (nTx=1,nRx=2, MRC)’, ‘theory (nTx=2, nRx=1, Alamouti)’, ‘sim (nTx=2, nRx=1, Alamouti)’);

xlabel(‘Eb/No, dB’);

ylabel(‘Bit Error Rate’);

title(‘BER for BPSK modulation with Alamouti STBC (Rayleigh channel)’);

===============================================

qpskmod.m

% Program 3-9

% qpskmod.m

%

% Function to perform QPSK modulation

%

% Programmed by H.Harada

%

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

%****************** variables *************************

% paradata : input data (para-by-nd matrix)

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

paradata2=paradata.*2-1;

count2=0;

for jj=1:nd

isi = zeros(para,1);

isq = zeros(para,1);

for ii = 1 : m2

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

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

end

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

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

count2=count2+ml;

end

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

qpskdemod.m

% Program 3-10

% qpskdemod.m

%

% Function to perform QPSK demodulation

%

% programmed by H.Harada

%

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

%****************** variables *************************

% idata :input Ich data

% qdata :input Qch data

% demodata: demodulated data (para-by-nd matrix)

% para : Number of paralell channels

% nd : Number of data

% ml : Number of modulation levels

% (QPSK ->2 16QAM -> 4)

% *****************************************************

demodata=zeros(para,ml*nd);

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

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

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

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

I already solved, thanks a lot.

Just need to delete below line.

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

@KimMyungsong: Glad to hear

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

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

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 !

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

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.

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

hi krishna,

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

thank u.

@balu: Sorry, no.

Hi Krishna,

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

@Aditya: Thanks

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

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

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!

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

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 STBCsCode(:,2:2:end) = (1/sqrt(2))*(kron(ones(1,N/2),[-1;1]).*flipud(reshape(conj(s),2,N/2))); % [-x2* x1* ....]

sCode = zeros(2,N);

sCode(:,1:2:end) = (1/sqrt(2))*reshape(s,2,N/2); % [x1 x2 ...]

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

hMod = kron(reshape(h,2,N/2),ones(1,2)); % repeating the same channel for two symbols

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

% Channel and noise Noise addition

y = sum(hMod.*sCode,1) + 10^(-Eb_N0_dB(ii)/20)*n;

% Receiver

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

yMod(2,:) = conj(yMod(2,:)); % [y1 y1 ... ; y2* y2*...]

% forming the equalization matrix

hEq = zeros(2,N);

hEq(:,[1:2:end]) = reshape(h,2,N/2); % [h1 0 ... ; h2 0...]

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

hEq(1,:) = conj(hEq(1,:)); % [h1* h2* ... ; h2 -h1 .... ]

hEqPower = sum(hEq.*conj(hEq),1);

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

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

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

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

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

http://www.dsplog.com/2008/09/06/receiver-diversity-selection-diversity/

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.

@Excellsun: Will add that to the TODO list

thanks very for providing a very gud understanding of AL.STBC

krishna can u plz tel me ..

can u use the matlab builtin command: rayleighchan(ts,fd)

same for bpsk modulation command :psk.modem..will it work correctly becoz in ur all codes u have made ur own qpsk n bpsk modulators…plz help me ..n one more thing to ask if m using mimo ofdm then can i considered channel as flat fading channel as u did in it..bcoz of ofdm each subcarrier will suffer flat fading instead of frequency selective fading..plz do comment whether m right or wrong

many thanks in advance

waiting for ur reply

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

hi Krishna

My theses in MIMO in WIMMAX ,plz give me an idea for simulation.

Best regards.

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

can you help me please,

i am doing project based on MIMO-OFDM for reduction of peak to average power ratio. in this case i am using CI-OFDM with SFBC instead of STBC.

can you suggest any better technique than CI-OFDM, and how to write matlab code for CI-OFDM with SFBC.

thank you sir.

@sreenu: what is CI-OFDM?

Carrier Interferometry Orthogonal Frequency Division Multiplexing

(in CI OFDM , puts each bit/symbol on all carriers simultaneously)

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

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.

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.

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

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

@umesh: Glad to help

Are you sure about that?

@WiMAX: Yes

Dear Krishna

Good work…

Execuse me , I have a one question …is there a Threshold in Alamouti scheme in detection side ?

thank you

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

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

@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

Hi krishna

I have seen your code and it was great. But I want to ask u about the simulation of MIMO channel in three dimensions …. The vertical coordinate is the fading envelope, and the two horizontal coordinates are the time and distance…. I have simulated the fading with the time by using jakes mode but I don’t know how i can simulate the fading with distance for 2*2 real world MIMO channel. At least give me an equation of fading with distance.

Thank u in advance…

This is my fading simulation with time:-

clear

t_sample = 0.001;

t = (0:8/t_sample)*t_sample;

fc = 220.5625*10^6;

N = 100;

c = 2.998*10^8;

v = 45*1000/3600;

lambda = c/fc;

fd = v/lambda;

f = linspace(-1/t_sample*1/2,1/t_sample*1/2,16000);

Eo = 1;

sigma = 1;

Cn = 1/(2*pi);

alpha = rand(1,N).*2*pi;

phi = rand(1,N).*2*pi;

Tc = zeros(1,length(t));

Ts = zeros(1,length(t));

for n = 1:N; % loop to superimpose the N signals

Tc_n = Cn*cos(fd*2*pi*t*cos(alpha(n))+phi(n));

Ts_n = Cn*sin(fd*2*pi*t*cos(alpha(n))+phi(n));

Tc = Tc+Tc_n;

Ts = Ts+Ts_n;

end

Env = (Tc.^2 + Ts.^2).^0.5;

plot(t(1:4/t_sample),10*log10(Env(1:4/t_sample)))

title(‘Received Signal Envelope’);

xlabel(‘time (s)’)

ylabel(‘Magnitude of E Field (dB)’)

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

Exellent theory and simulation i found kit useful.

@Khattak: Glad to hear.

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

dear

We haveMultiple InputMultiple Output (MIMO) digital communication system consisting of two transmit

antennas (NT = 2) and one receive antenna (NR = 1).

Alamouti space-time (ST) block code is defined by folowing NT × L code matrix

X = x1 −x

2

x2 x

1

where L is a codeword length.

• implement a digital modulator involving Alamouti STBC

• modulated signal passes frequency-flatMIMO fading channel with AWGN

• construct a decoder for given communication system

• compare the performance of given system with the reference (scalar, SISO) system — display BER

(or SER) curves in the same figure

thanks, chadi_lb@hotmail.com

@chadi: Good luck for your assignment.

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

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

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

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

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

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

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…

plz krishna;

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

@SAEED: The 1 transmit 1 receive case is discussed in the post

http://www.dsplog.com/2008/08/10/ber-bpsk-rayleigh-channel/

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!

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

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

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

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

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

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

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

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

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!

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!

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

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

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

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

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 ?

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

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!

@gly: Sorry, I do not have Simulink

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

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

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…

@abubaker: Thanks

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

Kluwer Academic Publishers, 2000.

hi krishna,

Thanks for your excellent work.

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

Hoping your replay.

Thanks very much.

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

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

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

great job krishna i hope you continue you’r

devolopment of alamouti……..

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

http://www.dsplog.com/2009/03/15/alamouti-stbc-2-receive-antenna/

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

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

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

@Murali: Sorry, I have not worked on QOSTBC

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

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

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

@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

Hi Krishna & others,

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

Can someone pls help to show/point where I’m doing wrong in my current simulation (getting extremely high BER):

1) input data modified to Alamouti scheme

2) generate 4 paths (divided into 2 sets to ensure the channel remain constant for 2 timeslot at least at each antenna)

3) 2 independent AWGN

4a) combine path1&2 with signal & add noise 1.

4b) combine path 3&4 with signal & add noise2.

5) perform 2 separate channel equalization

to get 2 estimated transmitted data

6) perform MRC based on original channel in (2)

7) count error

please help.. running out of ideas

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”

hi krishna…

please suggest me code for Alamouti with OFDM…

@Suchitra: Please refer to the post on

http://www.dsplog.com/2008/10/16/alamouti-stbc/

@Suchitra: Please refer to the post on

http://www.dsplog.com/2008/10/16/alamouti-stbc/

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

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

Hello Krishna,

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

Thank you

@Rocco: Thanks

hi,

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

so, in the case of for Alamouti 2×2 MIMO (orthogonal), how do I modify the equalization matrix into 2 receiver for BPSK?

what’s the method to expand this to QPSK&QAM?

e.g. in the given Matlab code:

rx_Mod = kron(reshape(rx,2,N/2),ones(1,2));

rx_Mod(2,:) = conj(rx_Mod(2,:));

% forming the equalization matrix

hEq = zeros(2,N);

hEq(:,[1:2:end])=reshape(h,2,N/2);

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

hEq(1,:) = conj(hEq(1,:)); hEqPower = sum(hEq.*conj(hEq),1);

please help

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

Thank you so much Krishna

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

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

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

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.

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

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,

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,

Hi krishna

can u tell plz why you h

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

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

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

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

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

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

Excellent! Hope you can put more posts on MIMO.

@Avlina: Thanks, glad it helped.

well explained.

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

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…

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

@piyush: In MIMO, one can transmit independent information on each channel

{ 4 trackbacks }