%logmap译码算法,zhenshu为所选帧包含的bit数
function [l_all,waixinxi]=logmapsuanfa(shuru,g,xianyan,index)
zhenshu=length(shuru)/2;
[n,k]=size(g);
m=k-1;
state=2^m;
a=zeros(zhenshu+1,state);
b=zeros(zhenshu+1,state);
[next_out,next_state,last_out,last_state] = wanggersc(g);
jidazhi=1e10;
a(1,1)=0;
a(1,2:state)=-jidazhi*ones(1,state-1);
if (index==1)
b(zhenshu,1)=0;
b(zhenshu,2:state)=-jidazhi*ones(1,state-1);
else
b(zhenshu,1:state)=zeros(1,state);
end
%计算a
for i=2:zhenshu+1
for j=1:state
qiao=-jidazhi*ones(1,state);
qiao(last_state(j,1))=-log(1+exp(xianyan(i-1)))-shuru(2*i-3)+shuru(2*i-2)*last_out(j,2);
qiao(last_state(j,2))=xianyan(i-1)-log(1+exp(xianyan(i-1)))+shuru(2*i-3)+shuru(2*i-2)*last_out(j,4);
if (sum(exp(qiao+a(i-1,:)))<1e-300)
a(i,j)=-jidazhi;
else
a(i,j)=log(sum(exp(qiao+a(i-1,:))));
end
end
temp(i)=max(a(i,:));
a(i,:)=a(i,:)-temp(i);
end
%计算b
for i=zhenshu-1:-1:1
for j=1:state
qiao=-jidazhi*ones(1,state);
qiao(next_state(j,1))=-log(1+exp(xianyan(i+1)))-shuru(2*i+1)+shuru(2*i+2)*next_out(j,2);
qiao(next_state(j,2))=xianyan(i+1)-log(1+exp(xianyan(i+1)))+shuru(2*i+1)+shuru(2*i+2)*next_out(j,4);
if (sum(exp(qiao+b(i+1,:)))<1e-300)
b(i,j)=-jidazhi;
else
b(i,j)=log(sum(exp(qiao+b(i+1,:))));
end
end
temp(i)=max(b(i,:));
b(i,:)=b(i,:)-temp(i);
end
%计算l_all
for i=1:zhenshu
for j=1:state
qiao0=-log(1+exp(xianyan(i)))-shuru(2*i-1)+shuru(2*i)*last_out(j,2);
qiao1=xianyan(i)-log(1+exp(xianyan(i)))+shuru(2*i-1)+shuru(2*i)*last_out(j,4);
temp0(j)=exp(qiao0+a(i,last_state(j,1))+b(i,j));
temp1(j)=exp(qiao1+a(i,last_state(j,2))+b(i,j));
end
l_all(i)=log(sum(temp1))-log(sum(temp0));
end
for i=1:zhenshu
waixinxi(i)=2*shuru(2*i-1);
waixinxi(i)=l_all(i)-waixinxi(i)-xianyan(i);
end
kuochao88
- 粉丝: 0
- 资源: 1
最新资源
- Universal Scanner Portable 可扫描附近设备IP
- c#语言winforms开发 使用devexpress控件DocumentManager进行多文档管理,在父窗口打开多个子窗口的实例,有详细中文解释
- zigbee CC2530无线自组网协议栈系统代码实现串口打印数据.zip
- Oracle语句优化规则汇总pdf版最新版本
- 华硕B85 pro gamer 刷NVME的bin文件,直接用工具就能用
- VSCode-win32-x64-1.96.0
- zigbee CC2530无线自组网协议栈系统代码实现带路由器的多终端点播通信例程.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器、路由器、终端的点播无线通讯.zip
- Objective-C语言教程:从基础语法到高级特性全面解析
- 888482540328469DreamFace_4.9.0.apk
- IMG_5950.jpg
- zigbee CC2530无线自组网协议栈系统代码实现协调器按键控制终端LED灯和继电器动作.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器将串口接收的指令无线发给终端并控制终端LED灯.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器与多终端的组播组网及多终端的控制.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器与终端的TI Sensor实验和Monitor使用.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器与终端的广播组网与数据传输.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈