File:Soft34.png

From testwiki
Jump to navigation Jump to search
    Original file (577 × 433 pixels, file size: 19 KB, MIME type: image/png)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Created with help to MatLab 2014a. The main structural blocks for the simulation: 1) Message source; 2) M-QAM modulator (M is adjustable); 3) Convolutional encoder; 4) AWGN channel; 5) M-QAM demodulator with Approximate LLR (or Exact LLR) outputs; 6) Soft decision Viterbi decoder; 7) BER calculation.
    Date
    Source Own work
    Author Kirlf
    Other versions
    This graph image could be re-created using vector graphics as an SVG file. This has several advantages; see Commons:Media for cleanup for more information. If an SVG form of this image is available, please upload it and afterwards replace this template with {{vector version available|new image name}}.
    It is recommended to name the SVG file “Soft34.svg”—then the template Vector version available (or Vva) does not need the new image name parameter.
    PNG development
    InfoField
     This diagram was created with MATLAB.
    Source code
    InfoField

    MATLAB code

    clear; close all; clc
    rng default
    M = 4;                 % Modulation order
    k = log2(M);            % Bits per symbol
    EbNoVec = (0:6)';       % Eb/No values (dB)
    numSymPerFrame = 300000;   % Number of QAM symbols per frame
    modul = comm.PSKModulator(M, 'BitInput', true);
    berEstSoft = zeros(size(EbNoVec)); 
    trellis = poly2trellis(7,[171 133]);
    tbl = 96;
    rate = 3/4;
    spect = distspec(trellis);
    encoders = comm.ConvolutionalEncoder(trellis,...
        'PuncturePatternSource', 'Property', 'PuncturePattern', [1; 1; 0; 1; 0; 1]);
    decoders = comm.ViterbiDecoder(trellis,'TracebackDepth',tbl,...
        'TerminationMethod','Continuous','InputFormat','Unquantized',...
        'PuncturePatternSource', 'Property', 'PuncturePattern', [1; 1; 0; 1; 0; 1]);
    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, numErrsHard, numBits] = deal(0);
        
        while numErrsSoft < 100 && numBits < 1e7
            % Generate binary data and convert to symbols
            dataIn = randi([0 1], numSymPerFrame*k, 1);
            
            % Convolutionally encode the data
            dataEnc = step(encoders, dataIn);
            % QAM modulate
            txSig = step(modul, dataEnc);
            % Pass through AWGN channel
            rxSig = awgn(txSig, snrdB, 'measured');
            
            % Demodulate the noisy signal using hard decision (bit) and
            % soft decision (approximate LLR) approaches.
            
            demods = comm.PSKDemodulator(M, 'BitOutput', true, ...
            'DecisionMethod', 'Approximate log-likelihood ratio', 'VarianceSource', 'Property', 'Variance', noiseVar);
            rxDataSoft = step(demods, rxSig);
        
            % Viterbi decode the demodulated data
            dataSoft = step(decoders, rxDataSoft);
                   
            % Calculate the number of bit errors in the frame. Adjust for the
            % decoding delay, which is equal to the traceback depth.
            numErrsInFrameSoft = biterr(dataIn(1:end-tbl), dataSoft(tbl+1:end));
            
            % Increment the error and bit counters
            numErrsSoft = numErrsSoft + numErrsInFrameSoft;
            numBits = numBits + numSymPerFrame*k;
        end
        
        % Estimate the BER for both methods
        berEstSoft(n) = numErrsSoft/numBits;
    end
    %% Theoretical curves
    spect = distspec(trellis, 7);
    soft_bertool = bercoding(EbNoVec,'conv','soft',1/2,spect); % BER bound
    figure(1)
    semilogy(EbNoVec, soft_bertool.','-o',EbNoVec,berEstSoft.','-o', 'LineWidth', 1.5)
    grid on
    hold on
    legend('1/2 (theory)','3/4 (simulation)','location','best')
    grid on
    xlabel('Eb/No (dB)')
    ylabel('Bit Error Rate')
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    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.

    Captions

    Convolutional codes with 1/2 and 3/4 code rates (and constraint length 7, Soft decision, 4-QAM / QPSK / OQPSK)

    Items portrayed in this file

    depicts

    17 January 2019

    19,639 byte

    433 pixel

    577 pixel

    image/png

    61db6479cc6e71bc231ee11fdb791969165505b9

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current21:58, 30 December 2020Thumbnail for version as of 21:58, 30 December 2020577 × 433 (19 KB)wikimediacommons>Kirlflooks better

    There are no pages that use this file.