?? mconvencoder.m
字號:
function [Out,BlkSize] = mConvEncoder(In,BlkSize,mode)
% Convolutional Encoder for the FEC Encoder for OFDMA
% of IEEE 802.16-2004 (WiMAX)
%
% [Out,BlkSize] = mConvEncoder(In,BlkSize,mode)
%
% In : binary input column vector or matrix (values 0 or 1)
% one column per code block
% BlkSize: row vector, length = number of code blocks
% number of data bits for each code block
% mode : specifies the decoding mode
% 0 = CC (tail-biting)
% 3 = ZT-CC (zero-tailing)
%
% Out : binary output column vector or matrix (values 0 or 1)
% one column per code block
%
% This convolutional encoder is a 1/2 rate encoder only.
% The other rates are realized by puncturing.
%
% This convolutional encoder is implemented as tail-biting encoder.
% The last six input bits initialize the state of the shift register.
% The output block size is twice the input block size.
%
% Matlab 7 Release 14 SP2
% The communication toolbox is required.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mConvEncoder.m.rca $
% $Revision: 1.5 $
% $Date: Tue Aug 8 11:40:17 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[m,n]=size(In);
%check dimensions
[x,y]=size(BlkSize);
if ((x~=1)|(y~=n))
error('Error: BlkSize must be row vector with the same number of columns as In.');
end
%define constant
trellis = poly2trellis(7,[171 133]);
%allocate output blocks
if islogical(In)
%work-around since convenc does not allow logical input
Out=logical(zeros(m*2,n));
else
Out=zeros(m*2,n,class(In));
end
switch mode,
case 0 %tail-biting
for b=1:n, %loop over all blocks
initstate = [1 2 4 8 16 32]*logical(In(BlkSize(b)-5:BlkSize(b),b));
Out(1:2*BlkSize(b),b) = convenc(double(In(1:BlkSize(b),b)),trellis,initstate);
end
case 3 %zero-tailing
for b=1:n, %loop over all blocks
In(BlkSize(b)-7:BlkSize(b),b)=0; % set last byte to zero
Out(1:2*BlkSize(b),b) = convenc(double(In(1:BlkSize(b),b)),trellis);
end
otherwise
error('Error: Viterbi decoder mode unknown.');
end
BlkSize = BlkSize*2;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -