% ------------------------------
% backward propagation

function [logb] = logbeta(x,hmm)

n = length(x);
logb = zeros(length(hmm.p0),n);

lp0 = log(hmm.p0);
lPo = log(hmm.Po);
lPt = log(hmm.Pt);

for t=n-1:-1:1,
  logb(:,t) = logsumexp(op(logb(:,t+1)+lPo(:,x(t+1)),'+',lPt'))' ;
end;



