« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Reliability
Model Standby Systems
Compare mean time to failure (MTTF) between different kinds of standby systems.
In[1]:=
X
marker[c1_, c2_] := Graphics[{c1, Rectangle[], c2, Rectangle[{1, 0}]}];
In[2]:=
X
sfPlot[dist_, c1_, c2_] := Module[{mttf = Mean[dist]}, Legended[Show[ Plot[Evaluate@SurvivalFunction[dist, t], {t, 0, 12}, Filling -> Axis, PlotRange -> {0, 1}, Ticks -> None, ImageSize -> 160], ListPlot[{Labeled[{mttf, SurvivalFunction[dist, mttf]}, Row[{"MTTF: ", Round[mttf, 0.01]}]]}, Filling -> Axis]], {Placed[ SwatchLegend[{Blue}, {""}, LegendMarkers -> marker[c1, c2], LegendMarkerSize -> {20, 10}], {0.9, 0.9}]}]]
In[3]:=
X
xlabels = {Rotate[SwatchLegend[{Blue}, {"Cold"}], \[Pi]/2], Rotate[SwatchLegend[{Red}, {"Warm"}], \[Pi]/2], Rotate[SwatchLegend[{Orange}, {"Mixed"}], \[Pi]/2]}; ylabels = {"", SwatchLegend[{Green}, {"Perfect Switch"}], SwatchLegend[{Orange}, {"Switch with Probability"}], SwatchLegend[{Lighter@Purple}, {"Switch with Lifetime"}]};
In[4]:=
X
xcolor = {Blue, Red, Orange}; ycolor = {Green, Orange, Lighter@Purple};
In[5]:=
X
\[ScriptCapitalD] = ExponentialDistribution[1/2]; Subscript[\[ScriptCapitalD], warm] = ExponentialDistribution[1/10]; Subscript[\[ScriptCapitalD], switch] = ExponentialDistribution[1/20]; Subscript[\[ScriptCapitalD], cp] = StandbyDistribution[\[ScriptCapitalD], {\[ScriptCapitalD], \ \[ScriptCapitalD]}]; Subscript[\[ScriptCapitalD], ci] = StandbyDistribution[\[ScriptCapitalD], {\[ScriptCapitalD], \ \[ScriptCapitalD]}, 0.9]; Subscript[\[ScriptCapitalD], cil] = StandbyDistribution[\[ScriptCapitalD], {\[ScriptCapitalD], \ \[ScriptCapitalD]}, Subscript[\[ScriptCapitalD], switch]]; Subscript[\[ScriptCapitalD], wp] = StandbyDistribution[\[ScriptCapitalD], \ {{Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}, {Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}}]; Subscript[\[ScriptCapitalD], wi] = StandbyDistribution[\[ScriptCapitalD], \ {{Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}, {Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}}, 0.9]; Subscript[\[ScriptCapitalD], wil] = StandbyDistribution[\[ScriptCapitalD], \ {{Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}, {Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}}, Subscript[\[ScriptCapitalD], switch]]; Subscript[\[ScriptCapitalD], wcp] = StandbyDistribution[\[ScriptCapitalD], \ {{Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}, \[ScriptCapitalD]}]; Subscript[\[ScriptCapitalD], wci] = StandbyDistribution[\[ScriptCapitalD], \ {{Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}, \[ScriptCapitalD]}, 0.9]; Subscript[\[ScriptCapitalD], wcil] = StandbyDistribution[\[ScriptCapitalD], \ {{Subscript[\[ScriptCapitalD], warm], \[ScriptCapitalD]}, \[ScriptCapitalD]}, Subscript[\[ScriptCapitalD], switch]];
In[6]:=
X
distributions = {{Subscript[\[ScriptCapitalD], cp], Subscript[\[ScriptCapitalD], ci], Subscript[\[ScriptCapitalD], cil]}, {Subscript[\[ScriptCapitalD], wp], Subscript[\[ScriptCapitalD], wi], Subscript[\[ScriptCapitalD], wil]}, {Subscript[\[ScriptCapitalD], wcp], Subscript[\[ScriptCapitalD], wci], Subscript[\[ScriptCapitalD], wcil]}};
In[7]:=
X
table = Table[ sfPlot[distributions[[i, j]], xcolor[[i]], ycolor[[j]]], {i, 3}, {j, 3}];
In[8]:=
X
Grid[Prepend[Prepend[table\[Transpose], xlabels]\[Transpose], ylabels], Frame -> All, FrameStyle -> Gray, Spacings -> {1.1, 1.1}]
Out[8]=