Cody

# Problem 501. Let's do Markov Chains!

Solution 62610

Submitted on 18 Mar 2012 by Alan Chalker
• Size: 39
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% mc = [0.5 0.2 0; 0.2 0 0.6; 0.3 0 0.4]; states = [0.3 0.21; 0.3 0.3; 0.4 0.49]; MC = [0.5 0.2 0; 0.2 0 0.6; 0.3 0.8 0.4]; assert(isequal(markov(mc,states),MC))

MC = 0.5000 0.2000 0 0.2000 0 0.6000 0.3000 0.8000 0.4000

2   Pass
%% mc = [0.5 0.2 0; 0 0 0.6; 0.3 0.8 0.4]; states = [0.5 0.31; 0.3 0.22; 0.2 0.47]; MC = [0.5 0.2 0; 0.2 0 0.6; 0.3 0.8 0.4]; assert(isequal(markov(mc,states),MC))

MC = 0.5000 0.2000 0 0.2000 0 0.6000 0.3000 0.8000 0.4000

3   Pass
%% mc = [0.4 0; 0.6 0.23]; states = [0.1 0.733; 0.9 0.267]; MC = [0.4 0.77; 0.6 0.23]; assert(isequal(markov(mc,states),MC))

MC = 0.4000 0.7700 0.6000 0.2300

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!