卷积码的维特比译码函数(Viterbi decoding function of convolutional codes).docVIP

  • 40
  • 0
  • 约6.69千字
  • 约 12页
  • 2017-08-04 发布于河南
  • 举报

卷积码的维特比译码函数(Viterbi decoding function of convolutional codes).doc

卷积码的维特比译码函数(Viterbi decoding function of convolutional codes) [ decoder_output功能,survivor_state,cumulated_metric ] =维特比(G,K,channel_output) %卷积码的维特比译码函数 Viterbi卷积码的维特比解码器% [ decoder_ouput %,survivor_state,cumulated_metric ] =维特比(G,K,channel_output) % G是一个n路矩阵,该矩阵的每一行确 定了从移位记错器到第N个输出间的连接%, %是码速率。 survivor_state是表示通过网络的最佳路径的矩阵%。 %量度在另一个函数度量(x,y)中给出,而且可根据 %硬判决和软判决来指定。 %该算法最小化了量度而不是最大化似然 N =大小(G,1);%取出矩阵G的一维大小,即得出输出端口 %检查大小 如果REM(大小(G,2),k)~ = 0%当G列数不是K的整数倍时 误差(G和K size不同意)%发出出错信息 结束 如果REM(尺寸(channel_output,2),N = 0%)~当输出量元素个数不是输出端口的整数倍时 错误(channel输出不正确的大小发出出错信息)% 结束 L =大小(G,2)/ K;%得出移位数,即寄存器的个数 由于L-1个寄存器的状态即可表示出输出状态%, %所以总的状态数number_of_states可由前L-1个 %寄存器的状态组合来确定 number_of_states = 2 ^((L-1)×K); %产生状态转移矩阵、输出矩阵和输入矩阵 J = 0:number_of_states-1 % J表示当前寄存器组的状态因为状态是从零 %开始的,所以循环从0到number_of_states-1 L = 0:2 ^ K-1 % L为从K个输入端的信号组成的状态,总的状 %态数为2 ^ K,所以循环从0到2 ^ K-11 nxt_stat完成从当前的状态和输入的矢量得出下寄存器组的一个状态% [ next_state,memory_contents ] = nxt_stat(J,L,L,K); 输入数组值是用于记录当前状态到下一个状态所要的输入信号矢量% %输入数组的维数:一维坐标x = j + 1指当前状态的值 %二维坐标y = next_state + 1指下一个状态的值 %由于MATLAB中数组的下标是从1开始的,而状态值 %是从0开始的,所以以上坐标值为:状态值+ 1 输入(j + 1,next_state + 1)= L; % branch_output用于记录在状态下输入L时的输出[J]. branch_output = REM(memory_contents * G,2); % nextstate array records the current state of the j input L the next state Nextstate (j+1, l+1) =next_state; % output array records the current state of the j input and output at L (decimal) Output (j+1, l+1) =bin2deci (branch_output); End End % state_metric array is used to record the decoding process in each state of the Hamming distance The size of number_of_states% state_metric (2: 1) current % state position Hamming distance, to determine the value, and (:, 2) for the current state and input % get the next state for the temporary value of Hamming distance. State_metric=zeros (number_of_states, 2); % depth_of_trellis for recording grid graph depth Depth_of_trellis=length (channel_output) /n; % of the output matrix, each column as an output state Channel_output_matrix=reshape (channe

文档评论(0)

1亿VIP精品文档

相关文档