« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Markov Chains and Queues
Visualize a Sample Path for a Finite Markov Process
Visualize a sample path for a discrete Markov process.
In[1]:=
X
\[ScriptCapitalP] = DiscreteMarkovProcess[1, ({ {0, 1/2, 1/2}, {1/2, 0, 1/2}, {1/2, 1/2, 0} })];
In[2]:=
X
data = RandomFunction[\[ScriptCapitalP], {0, 50}];
In[3]:=
X
ListPlot[data, Filling -> Axis, Ticks -> {Automatic, {1, 2, 3}}, PlotRange -> All]
Out[3]=
Visualize a sample path for a continuous Markov process.
In[4]:=
X
\[ScriptCapitalP] = ContinuousMarkovProcess[1, ({ {0, 1/2, 1/2}, {1/2, 0, 1/2}, {1/2, 1/2, 0} }), {2, 7, 3}];
In[5]:=
X
data = RandomFunction[\[ScriptCapitalP], {0, 10}];
In[6]:=
X
ListLinePlot[data, Filling -> Axis, Ticks -> {Automatic, {1, 2, 3}}, PlotRange -> All, InterpolationOrder -> 0]
Out[6]=