
function [ps] = poststate(x,hmm);

n = length(x);

a = alpha(x,hmm); % forward propagation
b = beta(x,hmm);  % backward propagation

ps = (a.*b)/sum(a(:,n)); 
