LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
DTMCSolve.m
1% pi = DTMCSolve(Q)
2%
3% Computes the stationary solution of a discrete time
4% Markov chain.
5%
6% Parameters
7% ----------
8% P : matrix, shape (M,M)
9% The transition probability matrix of the Markov
10% chain
11%
12% Returns
13% -------
14% pi : row vector, shape (1,M)
15% The vector that satisfies `\pi\, P = \pi, \sum_i \pi_i=1`
16%
17% Notes
18% -----
19% The procedure raises an exception if :code:`butools.checkInput`
20% is set to :code:`true` and :func:`CheckProbMatrix` (P) fails.
21
22function pi = DTMCSolve (P)
23
24 global BuToolsCheckInput;
25 if isempty(BuToolsCheckInput)
26 BuToolsCheckInput = true;
27 end
28
29 if BuToolsCheckInput && ~CheckProbMatrix(P, false)
30 error('DTMCSolve: The given matrix is not a valid transient probability matrix. If you are sure you want this use DRPSolve instead of DTMCSolve.');
31 end
32
33 pi = DRPSolve(P);
34end