Hidden Markov model states and emissions
[seq,states] = hmmgenerate(len,TRANS,EMIS)
hmmgenerate(...,'Symbols',SYMBOLS)
hmmgenerate(...,'Statenames',STATENAMES)
[seq,states] = hmmgenerate(len,TRANS,EMIS)
takes
a known Markov model, specified by transition probability matrix TRANS
and
emission probability matrix EMIS
, and uses it to
generate
A random sequence seq
of emission
symbols
A random sequence states
of states
The length of both seq
and states
is len
. TRANS(i,j)
is
the probability of transition from state i
to state j
. EMIS(k,l)
is
the probability that symbol l
is emitted from state k
.
Note
The function |
hmmgenerate(...,'Symbols',SYMBOLS)
specifies
the symbols that are emitted. SYMBOLS
can be a
numeric array or a cell array of the names of the symbols. The default
symbols are integers 1
through N
,
where N
is the number of possible emissions.
hmmgenerate(...,'Statenames',STATENAMES)
specifies
the names of the states. STATENAMES
can be a numeric
array or a cell array of the names of the states. The default state
names are 1
through M
, where M
is
the number of states.
Since the model always begins at state 1, whose transition probabilities
are in the first row of TRANS
, in the following
example, the first entry of the output states
is
be 1 with probability 0.95 and 2 with probability 0.05.
trans = [0.95,0.05; 0.10,0.90]; emis = [1/6 1/6 1/6 1/6 1/6 1/6; 1/10 1/10 1/10 1/10 1/10 1/2]; [seq,states] = hmmgenerate(100,trans,emis) [seq,states] = hmmgenerate(100,trans,emis,... 'Symbols',{'one','two','three','four','five','six'},... 'Statenames',{'fair';'loaded'})