📄 c_beta.m
字号:
% ======================================================================
% C_BETA.m
% =========
% Description: This m-file implements the Backward State-Metric Calcula-
% tor (BSMC) to be used in the MAP-decoder.
%
% Usage: [Beta0,Beta1] = c_beta(Gamma0, Gamma1, Alpha0, Alpha1, ...
% NSC, PSC)
% Inputs:
% Gamma0: Branch Metrics (BM) for complete trellis for input
% bit 0.
% Gamma1: Branch Metrics (BM) for complete trellis for input
% bit 1.
% Alpha0: Forward State- Metrics (FSM) for complete trellis for
% input bit 0.
% Alpha1: Forward State- Metrics (FSM) for complete trellis for
% input bit 1.
% NSC: Next-States-Connected.
% PSC: Previous-States-Connected
% Outputs:
% Beta0: The Backward State-Metrics (BSM) for complete trellis
% for input bit 0.
% Beta1: The Backward State-Metrics (BSM) for complete trellis
% for input bit 1.
%
% Output data format: AlphaI(State Number, Trellis Depth), where I=0,1
% depending on input bit.
% ======================================================================
function [Beta0,Beta1] = c_beta(Gamma0, Gamma1, Alpha0, Alpha1, NSC, PSC)
% --------------
% Initialisation
% --------------
[Number_Of_States, Trellis_Depth] = size(Gamma0);
Beta0 = zeros(Number_Of_States, Trellis_Depth);
Beta1 = zeros(Number_Of_States, Trellis_Depth);
SCHEME_Init = 3; % Reed's 'NEW' approach
% -------------------------------------
% Backward State-Metrics Initialisation
% -------------------------------------
% SCHEME 1: Assuming trellis termintaion
if SCHEME_Init == 1
% Reset of states (at TrellisDepth = End) to zero
for S=1:Number_Of_States
Beta0(S,Trellis_Depth) = 0.0;
Beta1(S,Trellis_Depth) = 0.0;
end
% Now we initialise the two branches ending in State 1
Beta0(PSC(1,1),Trellis_Depth) = 1.0;
Beta1(PSC(1,2),Trellis_Depth) = 1.0;
end
% SCHEME 2: Using Reed's 'NOTAIL' approach
if SCHEME_Init == 2
% Reset of states (at TrellisDepth = End) to final value(s) of ALPHA
for S=1:Number_Of_States
Beta0(S,Trellis_Depth) = Alpha0(S,Trellis_Depth);
Beta1(S,Trellis_Depth) = Alpha1(S,Trellis_Depth);
end
end
% SCHEME 3: Using Reed's 'NEW' approach
if SCHEME_Init == 3
% Reset of states (at TrellisDepth = End) to final
% value 1/(Number of States)
for S=1:Number_Of_States
Beta0(S,Trellis_Depth) = 1.0/Number_Of_States;
Beta1(S,Trellis_Depth) = 1.0/Number_Of_States;
end
end
NormaliseFactor = 1.0;
% ----------------------------------------------
% M A P: Backward State-Metric Calculator (BSMC)
% ----------------------------------------------
% Now for the remaing trellis, calculate the Backward State Metrics
for TD=Trellis_Depth-1:-1:1
NewLargest = 0.0;
for S=1:Number_Of_States
% Do for input bit 0:
% ------------------
Beta0_Temp = Beta0(NSC(S,1),TD+1) * Gamma0(NSC(S,1),TD+1);
Beta1_Temp = Beta1(NSC(S,1),TD+1) * Gamma1(NSC(S,1),TD+1);
Beta0(S,TD) = (Beta0_Temp + Beta1_Temp) / NormaliseFactor;
if Beta0(S,TD) > NewLargest
NewLargest = Beta0(S,TD);
end
% Do for input bit 1:
% ------------------
Beta0_Temp = Beta0(NSC(S,2),TD+1) * Gamma0(NSC(S,2),TD+1);
Beta1_Temp = Beta1(NSC(S,2),TD+1) * Gamma1(NSC(S,2),TD+1);
Beta1(S,TD) = (Beta0_Temp + Beta1_Temp) / NormaliseFactor;
if Beta1(S,TD) > NewLargest
NewLargest = Beta1(S,TD);
end
end
NormaliseFactor = NewLargest;
if NormaliseFactor < 1.0
NormaliseFactor = 1.0;
end
end
% ======================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -