Main Content

ldpcQuasiCyclicMatrix

準巡回 LDPC 符号のパリティ チェック行列

R2021b 以降

    説明

    H = ldpcQuasiCyclicMatrix(blocksize,P) は、入力ブロック サイズ blocksize およびプロトタイプ行列 P に基づいて、準巡回 LDPC 符号のパリティチェック行列 H を返します。

    すべて折りたたむ

    準巡回 LDPC 符号のパリティチェック行列を作成します。ブロック サイズを 3 に、プロトタイプ行列を [0 -1 1 2; 2 1 -1 0] に設定します。

    blockSize = 3;
    p = [0 -1 1 2; 2 1 -1 0];
    pcmatrix = ldpcQuasiCyclicMatrix(blockSize,p)
    pcmatrix = 6x12 sparse logical array
       (1,1)      1
       (5,1)      1
       (2,2)      1
       (6,2)      1
       (3,3)      1
       (4,3)      1
       (6,4)      1
       (4,5)      1
       (5,6)      1
       (3,7)      1
       (1,8)      1
       (2,9)      1
       (2,10)     1
       (4,10)     1
       (3,11)     1
       (5,11)     1
       (1,12)     1
       (6,12)     1
    
    

    結果のパリティチェック行列がスパースかつ logical 行列であることを確認します。

    issparse(pcmatrix) & islogical(pcmatrix)
    ans = logical
       1
    
    

    パリティチェック行列は大きくなる可能性があるため、非スパース行列として表示することは一般的に推奨しません。この例のパリティチェック行列は 6 行 12 列しかないため、非スパース行列として表示します。

    full(pcmatrix)
    ans = 6x12 logical array
    
       1   0   0   0   0   0   0   1   0   0   0   1
       0   1   0   0   0   0   0   0   1   1   0   0
       0   0   1   0   0   0   1   0   0   0   1   0
       0   0   1   0   1   0   0   0   0   1   0   0
       1   0   0   0   0   1   0   0   0   0   1   0
       0   1   0   1   0   0   0   0   0   0   0   1
    
    

    IEEE® 802.11 で指定された符号化率 3/4 の LDPC 符号を構成するために、プロトタイプ行列とブロック サイズのパラメーターを初期化します。関数 ldpcQuasiCyclicMatrix を使用して、パリティチェック行列を作成します。

    P = [16 17 22 24  9  3 14 -1  4  2  7 -1 26 -1  2 -1 21 -1  1  0 -1 -1 -1 -1
         25 12 12  3  3 26  6 21 -1 15 22 -1 15 -1  4 -1 -1 16 -1  0  0 -1 -1 -1
         25 18 26 16 22 23  9 -1  0 -1  4 -1  4 -1  8 23 11 -1 -1 -1  0  0 -1 -1
          9  7  0  1 17 -1 -1  7  3 -1  3 23 -1 16 -1 -1 21 -1  0 -1 -1  0  0 -1
         24  5 26  7  1 -1 -1 15 24 15 -1  8 -1 13 -1 13 -1 11 -1 -1 -1 -1  0  0
          2  2 19 14 24  1 15 19 -1 21 -1  2 -1 24 -1  3 -1  2  1 -1 -1 -1 -1  0
        ];
    blockSize = 27;
    pcmatrix = ldpcQuasiCyclicMatrix(blockSize,P);

    LDPC 符号化器構成オブジェクトを作成し、そのプロパティを表示します。構成オブジェクトの NumInformationBits プロパティを使用してランダムな情報ビットを生成し、LPDC コードワードの情報ビット数を指定します。LDPC 符号化器構成オブジェクトで指定された LDPC 符号で情報ビットを符号化します。

    cfgLDPCEnc = ldpcEncoderConfig(pcmatrix)
    cfgLDPCEnc = 
      ldpcEncoderConfig with properties:
    
         ParityCheckMatrix: [162x648 logical]
    
       Read-only properties:
               BlockLength: 648
        NumInformationBits: 486
        NumParityCheckBits: 162
                  CodeRate: 0.7500
    
    
    infoBits = rand(cfgLDPCEnc.NumInformationBits,1) < 0.5;
    codeword = ldpcEncode(infoBits, cfgLDPCEnc);

    IEEE® 802.11 で指定された符号化率 3/4 の LDPC 符号を構成するために、プロトタイプ行列とブロック サイズのパラメーターを初期化します。関数 ldpcQuasiCyclicMatrix を使用して、パリティチェック行列を作成します。

    P = [
        16 17 22 24  9  3 14 -1  4  2  7 -1 26 -1  2 -1 21 -1  1  0 -1 -1 -1 -1
        25 12 12  3  3 26  6 21 -1 15 22 -1 15 -1  4 -1 -1 16 -1  0  0 -1 -1 -1
        25 18 26 16 22 23  9 -1  0 -1  4 -1  4 -1  8 23 11 -1 -1 -1  0  0 -1 -1
         9  7  0  1 17 -1 -1  7  3 -1  3 23 -1 16 -1 -1 21 -1  0 -1 -1  0  0 -1
        24  5 26  7  1 -1 -1 15 24 15 -1  8 -1 13 -1 13 -1 11 -1 -1 -1 -1  0  0
         2  2 19 14 24  1 15 19 -1 21 -1  2 -1 24 -1  3 -1  2  1 -1 -1 -1 -1  0
        ];
    blockSize = 27;
    pcmatrix = ldpcQuasiCyclicMatrix(blockSize,P);

    LDPC 符号化器と LDPC 復号化器の構成オブジェクトを作成し、それらのプロパティを表示します。

    cfgLDPCEnc = ldpcEncoderConfig(pcmatrix)
    cfgLDPCEnc = 
      ldpcEncoderConfig with properties:
    
         ParityCheckMatrix: [162x648 logical]
    
       Read-only properties:
               BlockLength: 648
        NumInformationBits: 486
        NumParityCheckBits: 162
                  CodeRate: 0.7500
    
    
    cfgLDPCDec = ldpcDecoderConfig(pcmatrix)
    cfgLDPCDec = 
      ldpcDecoderConfig with properties:
    
         ParityCheckMatrix: [162x648 logical]
                 Algorithm: 'bp'
    
       Read-only properties:
               BlockLength: 648
        NumInformationBits: 486
        NumParityCheckBits: 162
                  CodeRate: 0.7500
    
    

    LDPC 符号化され、QPSK 変調されたビット ストリームを AWGN チャネル経由で送信します。信号を復調し、受信コードワードを復号化してから、ビット エラーをカウントします。入れ子の for ループを使用し、複数の SNR 設定、および送信データの LDPC 前方誤り訂正 (FEC) 符号化がある場合とない場合のフレームについて処理します。

    M = 4;
    maxnumiter = 10;
    snr = [3 6 20];
    numframes = 10;
    
    ber = comm.ErrorRate;
    ber2 = comm.ErrorRate;
    
    for ii = 1:length(snr)
        for counter = 1:numframes
            data = randi([0 1],cfgLDPCEnc.NumInformationBits,1,'int8');
            % Transmit and receive with LDPC coding
            encodedData = ldpcEncode(data,cfgLDPCEnc);
            modSignal = pskmod(encodedData,M,InputType='bit');
            [rxsig, noisevar] = awgn(modSignal,snr(ii));
            demodSignal = pskdemod(rxsig,M, ...
                OutputType='approxllr', ...
                NoiseVariance=noisevar);
            rxbits = ldpcDecode(demodSignal,cfgLDPCDec,maxnumiter);
            errStats = ber(data,rxbits);
            % Transmit and receive with no LDPC coding
            noCoding = pskmod(data,M,InputType='bit');
            rxNoCoding = awgn(noCoding,snr(ii));
            rxBitsNoCoding = pskdemod(rxNoCoding,M,OutputType='bit');
            errStatsNoCoding = ber2(data,int8(rxBitsNoCoding));
        end
        fprintf(['SNR = %2d\n   Coded: Error rate = %1.2f, ' ...
            'Number of errors = %d\n'], ...
            snr(ii),errStats(1),errStats(2))
        fprintf(['Noncoded: Error rate = %1.2f, ' ...
            'Number of errors = %d\n'], ...
            errStatsNoCoding(1),errStatsNoCoding(2))
        reset(ber);
        reset(ber2);
    end
    SNR =  3
       Coded: Error rate = 0.07, Number of errors = 355
    
    Noncoded: Error rate = 0.08, Number of errors = 384
    
    SNR =  6
       Coded: Error rate = 0.00, Number of errors = 0
    
    Noncoded: Error rate = 0.02, Number of errors = 98
    
    SNR = 20
       Coded: Error rate = 0.00, Number of errors = 0
    
    Noncoded: Error rate = 0.00, Number of errors = 0
    

    入力引数

    すべて折りたたむ

    準巡回 LDPC 符号のブロック サイズ。正のスカラーとして指定します。

    データ型: double

    プロトタイプ行列。行列として指定します。P の列数は P の行数より大きくなければなりません。P のすべての値は、-10、または入力 blocksize よりも小さい正の整数でなければなりません。-1 の値は、blocksizeblocksize 列のゼロ値の部分行列を生成します。他の値は、blocksizeblocksize 列の対角行列の列数を巡回的に右にシフトしなければならないことを示します。各部分行列は、ゼロ行列になるか巡回的にシフトした対角行列になります。

    データ型: double

    出力引数

    すべて折りたたむ

    パリティチェック行列。スパース logical 行列として返されます。この関数は、入力 P の各要素を blocksizeblocksize 列の部分行列として H に展開します。

    データ型: logical

    拡張機能

    C/C++ コード生成
    MATLAB® Coder™ を使用して C および C++ コードを生成します。

    バージョン履歴

    R2021b で導入