📄 initvit2.m
字号:
function initvit2(intrellis, inbranchweight, inpathlen, innormfunc)% % Initialize the data structures and pointers for the Viterbi algorithm% % function initvit1(intrellis, inbranchweight, inpathlen, innormfunc)%% intrellis: a description of the successor nodes % e.g. [1 3; 3 4; 1 2; 3 4]% inbranchweight: weights of branches used for comparison, saved as% cells in branchweight{state_number, branch_number}% branchweight may be a vector% e.g. branchweight{1,1} = 0; branchweight{1,2} = 6;% branchweight{2,1} = 3; branchweight{2,2} = 3;% branchweight{3,1} = 6; branchweight{3,2} = 0;% branchweight{4,1} = 3; branchweight{4,2} = 3;% inpathlen: length of window over which to compute% normfun: the norm function used to compute the branch cost% Copyright 1999 by Todd K. Moonclear savepath endp trellis pathlen numstate branchweightclear pathcost priorstate dooutput normfuncglobal savepath endp trellis pathlen numstate branchweightglobal pathcost priorstate dooutput normfunctrellis = intrellis+1;[numstate, temp] = size(trellis); % get number of statespathlen = inpathlen;normfunc = innormfunc;branchweight = inbranchweight;endp = 0;dooutput = 0;savepath = zeros(numstate,inpathlen);pathcost = (realmax/2)*ones(numstate,1); % set initially to huge numberpathcost(1) = 0;% set up the prior state informationnumpriorstate = zeros(numstate,1);% priorstate = [];for state=1:numstate for nextstate = trellis(state,:) numpriorstate(nextstate) = numpriorstate(nextstate)+1; priorstate(nextstate,numpriorstate(nextstate)) = state; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -