annotate toolboxes/FullBNT-1.0.7/HMM/dhmm_sample_endstate.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function [obs, hidden] = dhmm_sample_endstate(startprob, transmat, obsmat, endprob, numex)
Daniel@0 2 % SAMPLE_DHMM Generate random sequences from an HMM with discrete outputs.
Daniel@0 3 % function [obs, hidden] = sample_dhmm_endstate(startprob, transmat, obsmat, endprob, numex)
Daniel@0 4 %
Daniel@0 5 % We sample until we have have entered the end state
Daniel@0 6 % obs{m} and hidden{m} are the m'th sequence
Daniel@0 7
Daniel@0 8 hidden = cell(1,numex);
Daniel@0 9 obs = cell(1,numex);
Daniel@0 10
Daniel@0 11 for m=1:numex
Daniel@0 12 hidden{m} = mc_sample_endstate(startprob, transmat, endprob);
Daniel@0 13 T = length(hidden{m});
Daniel@0 14 obs{m} = zeros(1,T);
Daniel@0 15 for t=1:T
Daniel@0 16 h = hidden{m}(t);
Daniel@0 17 obs{m}(t) = sample_discrete(obsmat(h,:));
Daniel@0 18 end
Daniel@0 19 end