Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 symbolsA 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`

.

a with
probability _{k1}E. _{i1k11}`hmmgenerate` returns
i_{1} as the first entry of `states` ,
and a as
the first entry of _{k1}`seq` . |

`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'})

Was this topic helpful?