Clear Filters
Clear Filters

this program is producing a STBC matrix of 8*4 32 times. how can i put them in a single matrix of 256*4 dimension??

3 views (last 30 days)
clc;
clear;
close;
% QAM Modulator
sizeOfSignalConstellation = 16; % Size of signal constellation
numberOfBitsPerSymbol = log2(sizeOfSignalConstellation); % Number of bits per symbol
noOfBitsToProcess = 512; % Number of bits to process
A=noOfBitsToProcess/sizeOfSignalConstellation;
B=4;
numSamplesPerSymbol = 1; % Oversampling factor
rng default % Use default random number generator
vectorOfBinaryData = randi([0 1],noOfBitsToProcess,1); % Generate vector of binary data
binaryTuples = reshape(vectorOfBinaryData,length(vectorOfBinaryData)/4,4); % Reshape data into binary 4-tuples
dataSymbolsIn = bi2de(binaryTuples); % Convert to integersdataMod = qammod(dataSymbolsIn,M,0); % Binary coding, phase offset = 0
xx = qammod(dataSymbolsIn,sizeOfSignalConstellation,0,'gray'); % Gray coding, phase offset = 0
QamMatrix= vec2mat(xx,4);
Eb_No = 2*(sizeOfSignalConstellation-1)/3; %energy of the sysmbols
% Alamouti SPace Time Block Coder for four transmit Antennas
% Transmitters
SS=zeros(256,4);
for i= 1:A
for j=1:32
ss = QamMatrix(i,:);
STBC(:,:,i) = [ss(1) ss(2) ss(3) ss(4); ...
-1*ss(2) ss(1) -1*ss(4) ss(3); ...STBC
-1*ss(3) ss(4) ss(1) -1*ss(2); ...
-1*ss(4) -1*ss(3) ss(2) ss(1); ...
conj(ss(1)) conj(ss(2)) conj(ss(3)) conj(ss(4)); ...
-1*conj(ss(2)) conj(ss(1)) -1*conj(ss(4)) conj(ss(3));...
-1*conj(ss(3)) conj(ss(4)) conj(ss(1)) -1*conj(ss(2)); ...
-1*conj(ss(4)) -1*conj(ss(3)) conj(ss(2)) conj(ss(1))];
T(:,:,j)=STBC(:,:,i);
SS = reshape(T(:,:,j),8,4);
end
  7 Comments
Walter Roberson
Walter Roberson on 11 May 2017
Muhammad Awais Waheed comments to Jan Simon
when i used the above mentioned command by @KSSV than this is the error.
Error using reshape To RESHAPE the number of elements must not change.
Error in Untitled3 (line 51) X=reshape(STBC,8*32,4);

Sign in to comment.

Accepted Answer

Richard Fisher
Richard Fisher on 26 Apr 2017
There is another end missing from you code. Assuming it should be added at the end, try changing:
SS = reshape(T(:,:,j),8,4);
to
SS(8*(i-1)+1:8*i,:) = STBC(:,:,i);
This gives a final SS matrix which is 256 x 4, although you'll have to verify if this the behaviour you want.
Also, I'm not sure what the purpose of the inner loop is - it seems like you're calculating the same thing 32 times.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!