This file is from pmtk3.googlecode.com

setSeed(0);
nstates = 250;
d = 10;
T = 100;
model = mkRndGaussHmm(nstates, d); 
%% Sample data
X = hmmSample(model, T, 1);
%% infer single marginals using fwdback
tic
[gamma, logpHmm] = hmmInferNodes(model, X);
t = toc;
fprintf('fwdbck: %g seconds\n', t);
%% infer single marginals using varelim
if 0
    tic;
    dgm        = hmmToDgm(model, T, 'infEngine', 'varelim');
    margVelim  = dgmInferNodes(dgm, 'localev', X);
    gammaVelim = tfMarg2Mat(margVelim);
    t = to