一个简单的Viterbi解码程序
来源:互联网 发布:日事清 知乎 编辑:程序博客网 时间:2024/05/02 00:31
以下是一个简单的Viterbi解码程序的MATLAB实现。
% *********************************************% * *% * This function implements the viterbi *% * decoding mechanism. *% * *% *********************************************function output = viterbi_decode(input,L,K) ref_bit = [0 0 ; 0 1; 1 0 ; 1 1 ]; path = zeros(4,1); for i = 1:L+2 r = kron(ones(4,1),input(2*i-1:2*i)); hs = sum(xor(r,ref_bit),2); if (i == 1) || (i == 2) temp_path(1,1) = path(1,1) + hs(1); survivor_path(1,1) = 1; %survivor path temp_path(2,1) = path(3,1) + hs(3); survivor_path(2,1) = 3; temp_path(3,1) = path(1,1) + hs(4); survivor_path(3,1) = 1; temp_path(4,1) = path(3,1) + hs(2); survivor_path(4,1) = 3; else [temp_path(1,1), index] = min([path(1,1) + hs(1),path(2,1) + hs(4)]);%find the minimum survivor_path(1,1) = index; [temp_path(2,1), index] = min([path(3,1) + hs(3),path(4,1) + hs(2)]); survivor_path(2,1) = index+2; [temp_path(3,1), index] = min([path(1,1) + hs(4),path(2,1) + hs(1)]); survivor_path(3,1) = index; [temp_path(4,1), index] = min([path(3,1) + hs(2),path(4,1) + hs(3)]); survivor_path(4,1) = index+2; end path = temp_path; surPath(:,i) = survivor_path; end ipLUT = [0 0 0 0;0 0 0 0;1 1 0 0;0 0 1 1 ];%use as the reference cur_state = 1; decode = zeros(1,length(input)/2); for j = length(input)/2:-1:1 prev_state = surPath(cur_state,j); %survivor path found decode(j) = ipLUT(cur_state,prev_state);% cur_state = prev_state; end output = decode;end
0 0
- 一个简单的Viterbi解码程序
- 隐马尔可夫模型的Viterbi解码算法
- 隐马尔可夫模型的Viterbi解码算法
- 【2009】设计一个简单的编码、解码程序
- 简单的JPEG解码程序
- 简单的JPEG解码程序
- 简单的JPEG解码程序
- 简单的JPEG解码程序
- 最简单的编码解码程序
- 一个简单的“编码解码”,仅供参考
- H264解码的一个测试程序
- 简单的一个程序
- 一个简单的程序
- 一个简单的程序
- 维特比算法viterbi的简单实现 python版
- 从一个实例中学习关于HMM的Viterbi算法
- 字符的 编码 和 解码 的简单程序演示。
- matlab中 卷积码 及Viterbi解码内容
- 02http元素自定义配置
- @GeneratedValu
- python的一些技巧
- 准备到清明节了
- 阿里巴巴研发题目
- 一个简单的Viterbi解码程序
- Objective-C语法之基本数据类型
- 泄露Windows代码微软前员工认罪
- SEOer们极易轻忽的细节
- 我的钱去哪了?当卡被盗刷以后。。。
- extern关键字
- DFB GTK WEBKIT移植
- Python的中文处理
- 独立第三天