Problem 501. Let's do Markov Chains!
Markov Chains are really useful in a lot of fields. This problem will ask a question about a simple system with 3 states: A,B and C. The probability that one state will go to another can be given in a matrix such as:
mc = [0.5 0.2 0;
0.2 0 0.6;
0.3 0.8 0.4];
So, the first element is the probability that something in state A will remain in state A (0.5 here). The zero as the 5th element means nothing in state B will remain in state B. Now, if you are given the current state of the system, say state=[1 0 0], you can get the next state.
In this problem, I will given an incomplete matrix (A zero in place of one value), and then an initial state and the next state like:
states=[1 0.5;
0 0.2;
0 0.3]
You will have to provide the correct markov matrix as the output.
Round the output to 2 digits after decimal.
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
Alfonso Nieto-Castanon
on 15 Mar 2012
perhaps it's been changed already, test 2 does not look underconstrained (one additional constrain of mc is that its columns should add up to 1)
Alfonso Nieto-Castanon
on 16 Mar 2012
In fact tests 2 and 3 are 'overconstrained' (you do not need the 'states' information to solve these)
Rafael S.T. Vieira
on 12 Oct 2020
Please, do not use isequal with floats, check them against some tolerance: abs(a-b) < tol. Currently rounding numbers to 2 decimal places seems to fix the issue if the test suite is not updated. Good problem.
Solution Comments
Show commentsProblem Recent Solvers15
Suggested Problems
-
435 Solvers
-
272 Solvers
-
344 Solvers
-
14650 Solvers
-
Back to basics 21 - Matrix replicating
1631 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!