Requesting help with R=2/3 turbo encoding for lte waveform.
5 views (last 30 days)
Show older comments
James Long
on 31 Jan 2019
Answered: Baghdadi Aya
on 29 Aug 2021
Hi all,
I am trying to recreate an LTE compliant waveform ('A2-1') but I am running into some trouble. the current command: lteTurboEncode.m only supports R=1/3 turbo coding which i believe is leading me to biterrors when i go to undo all of the rate match, demodulation, etc.
Bottom line: Is there a way to implement 2/3 encoding? I've tried used the comms toolboox too, but with no luck.
Code is posted below. I highlighted in bold where I believe the issue is. You'll notice some is underlined too. that was my attempt at using the comms tool box to fix the problem, which is separate from the lte toolbox attempt (not underlined, but still in bold).
Thank you!
frc=lteRMCUL('A2-1');
frc.TotSubframes=1;
txdata=randi([0 1], frc.PUSCH.TrBlkSizes(1)*frc.TotSubframes, 1);
TrBLKcrc = lteCRCEncode(txdata,'24A');
%% PROBLEM HERE. %2/3 Rate Turbo encoding the bits.
trellis = poly2trellis([5 4],[23 35 0; 0 5 13]);
convEncoder = comm.ConvolutionalEncoder('TrellisStructure',trellis);
TRBOcodeBLK = convEncoder(TrBLKcrc);
TRBOcodeBLK = lteTurboEncode(TrBLKcrc);
%% END
TxTrBLKcrc = lteRateMatchTurbo(TRBOcodeBLK,frc.PUSCH.CodedTrBlkSizes(1),0,frc.PUSCH);
QAMsyms = lteSymbolModulate(TxTrBLKcrc,'16QAM');
[antseq,info,layerseq] = ltePUSCHDRS(frc,frc.PUSCH);
DRSind = ltePUSCHDRSIndices(frc,frc.PUSCH);
PUSCHind = ltePUSCHIndices(frc,frc.PUSCH);
TxSYMS(DRSind)=antseq;
TxSYMS(PUSCHind)=QAMsyms;
dims = lteULResourceGridSize(frc);
TxGrid = reshape(TxSYMS,[72 14]);
txWaveform = lteSCFDMAModulate(frc,TxGrid);
RxGrid = lteSCFDMADemodulate(frc,txWaveform);
RxSYMS = reshape(RxGrid,[prod(dims) 1]);
Rxbits = lteSymbolDemodulate(RxSYMS(PUSCHind),'16QAM','Hard');
undoRatematch = lteRateRecoverTurbo(Rxbits,frc.PUSCH.TrBlkSizes(1),0,frc.PUSCH);
%% This is where the problem lies!!!%%
traceBack = 16;
vitDecoder = comm.ViterbiDecoder('TrellisStructure',trellis,'InputFormat','Hard','TracebackDepth',traceBack);
RxTrBLKcrc = vitDecoder(cell2mat(undoRatematch));
RxTrBLKcrc = lteTurboDecode(undoRatematch);
[blk,err] = lteCRCDecode(RxTrBLKcrc,'24A'); %err should 0 if no problems.
0 Comments
Accepted Answer
Graham Freeland
on 5 Feb 2019
Hi,
You need to use soft demodulation of the 16QAM symbols, which is the default for that function i.e.
Rxbits = lteSymbolDemodulate(RxSYMS(PUSCHind),'16QAM');
or
Rxbits = lteSymbolDemodulate(RxSYMS(PUSCHind),'16QAM','Soft');
There is no 2/3 rate turbo coding in LTE. It's a fixed 1/3 coder with the overall code rate variation coming from the rate matching stage.
Graham
More Answers (1)
Baghdadi Aya
on 29 Aug 2021
i try also to code and decoed a random signal and to calculate the BER, but the problem that the code is too slow ,and the code execution can take more than 30 minutes for just few number of bits !!!
this is the code :
clear all
close all
M = 64; % Modulation order
bps = log2(M); % Bits per symbol
EbNo = (2:0.5:10);
pktLen = 100;
%Initialize the bit error rate vector.
ber = zeros(size(EbNo));
%Create System objects for a turbo encoder and decoder pair, where the interleaver indices are supplied as input arguments<
turboEnc = comm.TurboEncoder('InterleaverIndicesSource','Input port');
turboDec = comm.TurboDecoder('InterleaverIndicesSource','Input port', ...
'NumIterations',1);
%Create an AWGN channel System object and an error rate counter System object
awgnChannel = comm.AWGNChannel('NoiseMethod','Variance','Variance',1);
errorRate = comm.ErrorRate;
rate = pktLen/(3*pktLen+4*3);%rate de codeur
for k = 1:length(EbNo)
errorStats = zeros(1,3);
EsNo = EbNo(k) + 10*log10(bps);
snrdB = EsNo + 10*log10(rate); % in dB
noiseVar = 1./(10.^(snrdB/10));
awgnChannel.Variance = noiseVar;
while errorStats(2) < 100 && errorStats(3) < 1e7
% Generate random binary data
data = randi([0 1],pktLen,1);
% Interleaver indices
intrlvrInd = randperm(pktLen);
% Turbo encode the data
encodedData = turboEnc(data,intrlvrInd);
% Modulate the encoded data
modSignal = qammod(encodedData,M,'InputType','bit','UnitAveragePower',true);
% Pass the signal through the AWGN channel
rxSignal = awgnChannel(modSignal);
% Demodulate the received signal
demodSignal = qamdemod(rxSignal,M,'UnitAveragePower',true,'OutputType','llr','NoiseVariance',noiseVar);
% Turbo decode the demodulated signal. Because the bit mapping from the
% demodulator is opposite that expected by the turbo decoder, the
% decoder input must use the inverse of demodulated signal.
rxBits = turboDec(-demodSignal,intrlvrInd);
% Calculate the error statistics
errorStats = errorRate(data,rxBits);
% Save the BER data and reset the bit error rate object
ber(k) = errorStats(1);
reset(errorRate);
end
end
%Plot the bit error rate
fprintf('Bit error rate = %5.2e\nNumber of errors = %d\nTotal bits = %d\n', ...
errorStats)
semilogy(EbNo,ber,'-*')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')
I need t know where is the problem , by the way the most function that takes the most of time is in turbodecoder
0 Comments
See Also
Categories
Find more on LTE Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!