MATLAB: Hidden Markov Models - Computing Gamma

Formula

Implementation

function g = gamma_dynamic(alpha,beta) 
    %return alphas and betas
        a = alpha;
        b = beta;    
    %calculate denominator
    %sum over j (the different states)
        den = sum(a.*b,1);
    %populate matrix of gammas
        g = a.*b./den;   
end