Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 73419

Submitted on 10 Apr 2012 by RĂ©mi

Correct

88Size
Leading solution size is 39.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
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))

                    
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))

                    
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))