1 Star 0 Fork 0

zhoub86/ViterbiNet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
v_fViterbi.m 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
nirhlezinger1 提交于 2019-10-28 11:38 . Add files via upload
function v_fXhat = v_fViterbi(m_fPriors, s_nConst, s_nMemSize)
% Apply Viterbi detection from computed priors
%
% Syntax
% -------------------------------------------------------
% v_fXhat = v_fViterbi(m_fPriors, s_nConst, s_nMemSize)
%
% INPUT:
% -------------------------------------------------------
% m_fPriors - evaluated likelihoods for each state at each time instance
% s_nConst - constellation size (positive integer)
% s_nMemSize - channel memory length
%
%
% OUTPUT:
% -------------------------------------------------------
% v_fXhat - recovered symbols vector
s_nDataSize = size(m_fPriors, 1);
s_nStates = s_nConst^s_nMemSize;
v_fXhat = zeros(1, s_nDataSize);
% Generate trellis matrix
m_fTrellis = zeros(s_nStates,s_nConst);
for ii=1:s_nStates
Idx = mod(ii -1, s_nConst^(s_nMemSize-1));
for ll=1:s_nConst
m_fTrellis(ii,ll) = s_nConst*Idx + ll;
end
end
% Apply Viterbi
m_fCost = -log(m_fPriors);
v_fCtilde = zeros(s_nStates,1);
for kk=1:s_nDataSize
m_fCtildeNext = zeros(s_nStates,1);
for ii=1:s_nStates
v_fTemp = zeros(s_nConst,1);
for ll=1:s_nConst
v_fTemp(ll) = v_fCtilde(m_fTrellis(ii,ll)) + m_fCost(kk,ii);
end
m_fCtildeNext(ii) = min(v_fTemp);
end
v_fCtilde = m_fCtildeNext;
[~, I] = min(v_fCtilde);
% return index of first symbol in current state
v_fXhat(kk) = mod(I-1,s_nConst)+1;
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhoub86/ViterbiNet.git
git@gitee.com:zhoub86/ViterbiNet.git
zhoub86
ViterbiNet
ViterbiNet
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385