📄 bound.m
字号:
function [T,result]=bound(g,h,df)
[g_n,g_K] = size(g);
g_m = g_K - 1;
g_max_state = 2^g_m;
%calculate the parameters of h
[h_n,h_K] = size(h);
h_m = h_K - 1;
h_max_state = 2^h_m;
m=g_m + floor(h_m/g_n);
max_state = 2^m;
[next_out, next_state, last_out, last_state] = trellis(g);
W=sym('W');
D=sym('D');
%A=zeros(max_state);
for i=1:max_state
A(i,next_state(i,1))=D^(((next_out(i,1)+1)/2)^2+((next_out(i,2)+1)/2)^2);
A(i,next_state(i,2))=W*D^(((next_out(i,3)+1)/2)^2+((next_out(i,4)+1)/2)^2);
end
%A(1,1)=D^0;
%A(1,2)=W*D^2;
%A(2,3)=D;
%A(2,4)=W*D;
%A(3,1)=D^2;
%A(3,2)=W;
%A(4,3)=D;
%A(4,4)=W*D;
P=A((2:max_state),(2:max_state));
d=A(1,2:max_state);
m=A(2:max_state,1);
temp_P=eye(max_state-1);
%T=0;
T(1)=d*(temp_P)*m;
%TDW= T(1);
for k=1:10
temp_P=temp_P*P;
T(k+1)=d*(temp_P)*m;
end
TDW=sum(T(:));
TB=diff(TDW,W,1);
result_sym=subs(TB,W,1);
EbNo=(0.0:0.5:6.0);
C=0.5*erfc(sqrt(0.5*df*10.^(EbNo/10))).*exp(0.5*df*10.^(EbNo/10));
result=C.*subs(result_sym,D, exp(-0.5*10.^(EbNo/10)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -