令 生成多项式为:G(7,5)=[1 1 1;1 0 1] 注意是系统码
第一种方法:
a= poly2trellis(3, [7 5],7);
>> a.nextStates
ans =
0 2
2 0
3 1
1 3
function [next_out, next_state, last_out, last_state] = trellis(g)
% copyright Nov. 1998 Yufei Wu
% MPRG lab, Virginia Tech
% for academic use only
% set up the trellis given code generator g
% g given in binary matrix form. e.g. g = [ 1 1 1; 1 0 1 ];
% next_out(i,1:2): trellis next_out (systematic bit; parity bit) when input = 0, state = i; next_out(i,j) = -1 or 1
% next_out(i,3:4): trellis next_out (systematic bit; parity bit) when input = 1, state = i;
% next_state(i,1): next state when input = 0, state = i; next_state(i,i) = 1,...2^m
% next_state(i,2): next state when input = 1, state = i;
% last_out(i,1:2): trellis last_out (systematic bit; parity bit) when input = 0, state = i; last_out(i,j) = -1 or 1
% last_out(i,3:4): trellis last_out (systematic bit; parity bit) when input = 1, state = i;
% last_state(i,1): prev