c_alpha.m

来自「Space-Time Processing for CDMA Mobile Co」· M 代码 · 共 81 行

M
81
字号
% ======================================================================
% C_ALPHA.m
% =========
% Description: This m-file implements the Forward State-Metric Calculator
%              (FSMC) to be used in the MAP-decoder.
%
% Usage:  [Alpha0,Alpha1] = c_alpha(Gamma0, Gamma1, PSC)
% Inputs:
%          Gamma0: Branch Metrics (BM) for complete trellis for input
%                  bit 0.
%          Gamma1: Branch Metrics (BM) for complete trellis for input
%                  bit 1.
%             PSC: Previous-States-Connected
% Outputs:
%          Alpha0: The Forward State-Metrics (FSM) for complete trellis
%                  for input bit 0.
%          Alpha1: The Forward State-Metrics (FSM) for complete trellis
%                  for input bit 1.
%
%  Output data format: AlphaI(State Number, Trellis Depth), where I=0,1
%                      depending on input bit.
% ======================================================================
function [Alpha0,Alpha1] = c_alpha(Gamma0, Gamma1, PSC)

% --------------
% Initialisation
% --------------
[Temp, Trellis_Depth] = size(Gamma0);   % <==> Interleaver Size.
[Number_Of_States, Temp] = size(PSC);   % Number of States in trellis

Alpha0 = zeros(Number_Of_States, Trellis_Depth);
Alpha1 = zeros(Number_Of_States, Trellis_Depth);

% Initialise State 1 (at Trellis Depth = 1)
Alpha0(1,1) = Gamma0(1,1);
Alpha1(1,1) = Gamma1(1,1);

% Initialise normalisation factor with 'largest Gamma'.
if Gamma0(1,1) > Gamma1(1,1)
   NormaliseFactor = Gamma0(1,1);
else
   NormaliseFactor = Gamma1(1,1);
end


% ---------------------------------------------
% M A P: Forward State-Metric Calculator (FSMC)
% ---------------------------------------------

% Now for the remaing trellis calculate Forward State Metrics
for TD=2:Trellis_Depth
        NewLargest = 0.0;

   for S=1:Number_Of_States

      Alpha_Sum = Alpha0(PSC(S,1),TD-1) + Alpha1(PSC(S,2),TD-1);

      % Do for input bit 0:
      % ------------------
      Alpha0(S,TD) = (Gamma0(S,TD) * Alpha_Sum) / NormaliseFactor;

      if (Alpha0(S,TD) > NewLargest)
         NewLargest = Alpha0(S,TD);
      end

      % Do for input bit 1:
      % ------------------
      Alpha1(S,TD) = (Gamma1(S,TD) * Alpha_Sum) / NormaliseFactor;

      if (Alpha1(S,TD) > NewLargest)
         NewLargest = Alpha1(S,TD);
      end
        end
        NormaliseFactor = NewLargest;

   if NormaliseFactor < 1.0
      NormaliseFactor = 1.0;
   end
end
% ======================================================================

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?