File:Convolutional codes PSK QAM LLR.svg
Page contents not supported in other languages.
Tools
Actions
General
In other projects
Appearance
Size of this PNG preview of this SVG file: 498 × 374 pixels. Other resolutions: 320 × 240 pixels | 639 × 480 pixels | 1,023 × 768 pixels | 1,280 × 961 pixels | 2,560 × 1,923 pixels.
Original file (SVG file, nominally 498 × 374 pixels, file size: 77 KB)
This is a file from the Wikimedia Commons. Information from its description page there is shown below. Commons is a freely licensed media file repository. You can help. |
Summary
DescriptionConvolutional codes PSK QAM LLR.svg | |
Date | |
Source | Own work |
Author | Kirlf |
SVG development InfoField | |
Source code InfoField | MATLAB codeclear; close all; clc
rng default
M = [4, 8, 16, 64]; % Modulation order
EbNoVec = (0:5)'; % Eb/No values (dB)
numSymPerFrame = 100000; % Number of QAM symbols per frame
berEstSoft = zeros(size(EbNoVec));
trellis = poly2trellis(7,[171 133]);
tbl = 32;
rate = 1/2;
decoders = comm.ViterbiDecoder(trellis,'TracebackDepth',tbl,...
'TerminationMethod','Continuous','InputFormat','Unquantized');
for m = 1:length(M)
k = log2(M(m)); % Bits per symbol
if M(m) <= 8
modul = comm.PSKModulator(M(m), 'BitInput', true);
end
for n = 1:length(EbNoVec)
% Convert Eb/No to SNR
snrdB = EbNoVec(n) + 10*log10(k*rate);
% Noise variance calculation for unity average signal power.
noiseVar = 10.^(-snrdB/10);
% Reset the error and bit counters
[numErrsSoft_exact, numErrsHard, numBits] = deal(0);
[numErrsSoft_approx, numErrsHard, numBits] = deal(0);
while (numErrsSoft_exact < 100 OR numErrsSoft_approx < 100)...
&& numBits < 1e8
% Generate binary data and convert to symbols
dataIn = randi([0 1], numSymPerFrame*k, 1);
% Convolutionally encode the data
dataEnc = convenc(dataIn, trellis);
% QAM modulate
if M(m) <= 8
txSig = step(modul, dataEnc);
else
txSig = qammod(dataEnc, M(m), 'InputType','bit',...
'UnitAveragePower',true);
end
% Pass through AWGN channel
rxSig = awgn(txSig, snrdB, 'measured');
% Demodulate the noisy signal using hard decision (bit) and
% soft decision (approximate LLR) approaches.
if M(m) <= 8
demods_approx = comm.PSKDemodulator(M(m), ...
'BitOutput', true, ...
'DecisionMethod', ...
'Approximate log-likelihood ratio',...
'VarianceSource', 'Property', 'Variance', noiseVar);
demods_exact = comm.PSKDemodulator(M(m), ...
'BitOutput', true, ...
'DecisionMethod', 'Log-likelihood ratio',...
'VarianceSource', 'Property', 'Variance', noiseVar);
rxDataSoft_exact = step(demods_exact, rxSig);
rxDataSoft_approx = step(demods_approx, rxSig);
else
rxDataSoft_exact = qamdemod(rxSig, M(m), ...
'OutputType','llr', ...
'UnitAveragePower',true,'NoiseVariance',noiseVar);
rxDataSoft_approx = qamdemod(rxSig, M(m), ...
'OutputType','approxllr', ...
'UnitAveragePower',true,'NoiseVariance',noiseVar);
end
% Viterbi decode the demodulated data
dataSoft_exact = step(decoders, rxDataSoft_exact );
dataSoft_approx = step(decoders, rxDataSoft_approx);
% Calculate the number of bit errors in the frame.
% Adjust for the decoding delay,
% which is equal to the traceback depth.
numErrsInFrameSoft_exact = biterr(dataIn(1:end-tbl), ...
dataSoft_exact(tbl+1:end));
numErrsInFrameSoft_approx = biterr(dataIn(1:end-tbl), ...
dataSoft_approx(tbl+1:end));
% Increment the error and bit counters
numErrsSoft_exact = numErrsSoft_exact + ...
numErrsInFrameSoft_exact;
numErrsSoft_approx = numErrsSoft_approx + ...
numErrsInFrameSoft_approx;
numBits = numBits + numSymPerFrame*k;
end
% Estimate the BER for both methods
berEstSoft_exact(n, m) = numErrsSoft_exact/numBits;
berEstSoft_approx(n, m) = numErrsSoft_approx/numBits;
end
end
semilogy(EbNoVec, berEstSoft_exact(:, 1),'r-o', ...
EbNoVec, berEstSoft_exact(:, 2),'k-o',...
EbNoVec, berEstSoft_exact(:, 3),'b-o', ...
EbNoVec, berEstSoft_exact(:, 4),'c-o',...
EbNoVec, berEstSoft_approx(:, 1),'r->', ...
EbNoVec, berEstSoft_approx(:, 2),'k->',...
EbNoVec, berEstSoft_approx(:, 3),'b->', ...
EbNoVec, berEstSoft_approx(:, 4),'c->','LineWidth', 1.5)
hold on
legend('QPSK, Exact LLR', ...
'8PSK, Exact LLR', ...
'16-QAM, Exact LLR', ...
'64-QAM, Exact LLR',...
'QPSK, Approx. LLR', ...
'8PSK, Approx. LLR', ...
'16-QAM, Approx. LLR', ...
'64-QAM, Approx. LLR', ...
'location','best')
grid
title('Convolutional codes 1/2, AWGN')
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
- ↑ Digital modulation: Exact LLR Algorithm (MathWorks)
- ↑ Digital modulation: Approximate LLR Algorithm (MathWorks)
Items portrayed in this file
depicts
19 January 2021
image/svg+xml
284c77cbe85a0eb129a982ee85d670437c4ed616
79,314 byte
374 pixel
498 pixel
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 16:45, 19 January 2021 | 498 × 374 (77 KB) | Kirlf | Uploaded own work with UploadWizard |
File usage
The following page uses this file:
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
Width | 498 |
---|---|
Height | 374 |