I have a physical system, which I know the time average statistics. Its probability of being in state 1 is P1, state 2:P2 and state 3:P3. I want to simulate the time behavior of the system.
The Attempt at a Solution
I assume the rate of transition event to state i to be the probability Pi. So I can generate the time for the next transition event by using the fact that the time needed for next transition event is exponential distributed, F(t)=1-exp(-kt), k is the rate of event. I start the simulation at time 0 and at a random state. In each iteration, I generate 3 uniform random numbers, and calculate the time needed for the next transition for all three states (t=-ln(U)/k, U is an uniform random number), take the smallest time and update the time and state of the system to the state corresponding to the smallest time.
Is this a correct way of simulating such a system, coz I find that if I start at any of the state(let say state 1), the time that the system staying in that state seems to be longer than what I expect.
FYI, I am using matlab for numerical simulation.