I want to visualize my Markov chain using a digraph. I am using the following lines of code:
mc = dtmc(TPM,'StateNames',namesStates);
graphplot(mc,'ColorNodes',true,'ColorEdges',true);
where namesStates
is a cell array that contains the names (string) of each node of my MC.
Since the probabilities are so close to each other, I want to visualize the probabilities of each edge of the digraph or the transition rates. Is it possible?
EDIT:
Here is a TPM that I am using:
0,941033925686591 7,34322220590395e-05 0,000146864444118079 0,0220296666177119 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0,000220296666177119 0,926053752386547 0,000293728888236158 0 0,0367161110295198 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0,000367161110295198 0,000440593332354237 0,903730356880599 0 0 0,0587457776472316 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7,34322220590395e-05 0 0 0,940960493464532 7,34322220590395e-05 0,000146864444118079 0,0220296666177119 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 7,34322220590395e-05 0 0,000220296666177119 0,925980320164488 0,000293728888236158 0 0,0367161110295198 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 7,34322220590395e-05 0,000367161110295198 0,000440593332354237 0,903656924658540 0 0 0,0587457776472316 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 7,34322220590395e-05 0 0 0,962990160082244 7,34322220590395e-05 0,000146864444118079 0 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 7,34322220590395e-05 0 0,000220296666177119 0,962696431194008 0,000293728888236158 0 0 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 7,34322220590395e-05 0,000367161110295198 0,000440593332354237 0,962402702305772 0 0 0 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0 0
0,00367161110295198 0 0 0 0 0 0 0 0 0,937362314583639 7,34322220590395e-05 0,000146864444118079 0,0220296666177119 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0 0
0 0,00367161110295198 0 0 0 0 0 0 0 0,000220296666177119 0,922382141283595 0,000293728888236158 0 0,0367161110295198 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0 0
0 0 0,00367161110295198 0 0 0 0 0 0 0,000367161110295198 0,000440593332354237 0,900058745777647 0 0 0,0587457776472316 0 0 0 0 0 0,0367161110295198 0 0 0 0 0 0
0 0 0 0,00367161110295198 0 0 0 0 0 3,85519165809957e-05 0 0 0,937323762667058 7,34322220590395e-05 0,000146864444118079 0,0220296666177119 0 0 0 0 0 0,0367161110295198 0 0 0 0 0
0 0 0 0 0,00367161110295198 0 0 0 0 0 5,07906202575023e-05 0 0,000220296666177119 0,922331350663338 0,000293728888236158 0 0,0367161110295198 0 0 0 0 0 0,0367161110295198 0 0 0 0
0 0 0 0 0 0,00367161110295198 0 0 0 0 0 5,87457776472316e-05 0,000367161110295198 0,000440593332354237 0,900000000000000 0 0 0,0587457776472316 0 0 0 0 0 0,0367161110295198 0 0 0
0 0 0 0 0 0 0,00367161110295198 0 0 0 0 0 3,85519165809957e-05 0 0 0,959353429284770 7,34322220590395e-05 0,000146864444118079 0 0 0 0 0 0 0,0367161110295198 0 0
0 0 0 0 0 0 0 0,00367161110295198 0 0 0 0 0 5,07906202575023e-05 0 0,000220296666177119 0,959047461692858 0,000293728888236158 0 0 0 0 0 0 0 0,0367161110295198 0
0 0 0 0 0 0 0 0 0,00367161110295198 0 0 0 0 0 5,87457776472316e-05 0,000367161110295198 0,000440593332354237 0,958745777647232 0 0 0 0 0 0 0 0 0,0367161110295198
0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 0 0 0 0,970406814510207 7,34322220590395e-05 0,000146864444118079 0,0220296666177119 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 0 0 0,000220296666177119 0,955426641210163 0,000293728888236158 0 0,0367161110295198 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 0 0,000367161110295198 0,000440593332354237 0,933103245704215 0 0 0,0587457776472316 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 4,40593332354237e-05 0 0 0,970362755176972 7,34322220590395e-05 0,000146864444118079 0,0220296666177119 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 5,50741665442796e-05 0 0,000220296666177119 0,955371567043619 0,000293728888236158 0 0,0367161110295198 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 6,16830665295932e-05 0,000367161110295198 0,000440593332354237 0,933041562637686 0 0 0,0587457776472316
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 4,40593332354237e-05 0 0 0,992392421794684 7,34322220590395e-05 0,000146864444118079
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 5,50741665442796e-05 0 0,000220296666177119 0,992087678073139 0,000293728888236158
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,00734322220590395 0 0 0 0 0 6,16830665295932e-05 0,000367161110295198 0,000440593332354237 0,991787340284917
instead of:
mc = dtmc(TPM,'StateNames',namesStates);
We can do:
mc = dtmc(TPM);
In the documentation you can find the 'LabelEdges' parameter, when set to true the probability is also displayed.
graphplot(mc,'ColorNodes',true,'ColorEdges',true,'LabelEdges',true);