HW054
Math 2984 - Fall 2017
Intro to Mathematical Problem Solving


TASK: Use a transition model to simulate how 800 students shift between three dormitories.


COMMENT: 800 students are assigned to the Able, Babel, and Cable dorms. Every month, they are allowed to change dorms if they want.

The registrar knows the probability that a student living in a dorm will choose to move after a month to Able (A), Babel (B), or Cable (C):

              This Month
            A     B     C
         -----------------
Next   A | 0.90  0.02  0.04
Month  B | 0.05  0.68  0.40
       C | 0.05  0.30  0.56
For instance, a student living in Cable dorm has an 0.04 probability of moving to Abel, a 0.40 probablity of moving to Babel, and a 0.56 probablity of staying in Cable.

The university initially assigns 0 students to Able, 300 to Babel, and 500 to Cable. Simulate the student population for 20 consecutive months.


INSTRUCTIONS:

        m = number of months
        P = m x m matrix of probabilities
        A, B, C = zero vectors of 1 row and m columns each.
        loop i from 1 to m
          if i is 1,
            initialize A(1), B(1), C(1)
          else
            A(i) = P(1,1) * A(i-1) + P(1,2) * B(i-1) + P(1,3) * C(i-1)
            B(i) = ?
            C(i) = ?
          end
        end
        plot ( 1:m, A, 1:m, B, 1:m, C )
      


CHECK: You might get something like this. I used the legend('A','B','C') command to connect the line colors to A, B, and C:


SUBMIT: Your script file should be named "hw054.m", and begin with:

        % hw054.m
        % YOUR NAME
        % This script (describe what it does)