LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
FluidSolve.m
1% [mass0, ini, K, clo] = FluidSolve (Fpp, Fpm, Fmp, Fmm, prec)
2%
3% Returns the parameters of the matrix-exponentially
4% distributed stationary distribution of a canonical
5% Markovian fluid model.
6%
7% The canonical Markov fluid model is defined by the
8% matrix blocks of the generator of the background Markov
9% chain partitioned according to the sign of the
10% associated fluid rates (i.e., there are "+" and "-" states).
11%
12% Using the returned 4 parameters the stationary
13% solution can be obtained as follows.
14%
15% The probability that the fluid level is zero while
16% being in different states of the background process
17% is given by vector mass0.
18%
19% The density that the fluid level is x while being in
20% different states of the background process is
21%
22% .. math::
23% \pi(x)=ini\cdot e^{K x}\cdot clo.
24%
25% Parameters
26% ----------
27% Fpp : matrix, shape (Np,Np)
28% The matrix of transition rates between states
29% having positive fluid rates
30% Fpm : matrix, shape (Np,Nm)
31% The matrix of transition rates where the source
32% state has a positive, the destination has a
33% negative fluid rate associated.
34% Fpm : matrix, shape (Nm,Np)
35% The matrix of transition rates where the source
36% state has a negative, the destination has a
37% positive fluid rate associated.
38% Fpp : matrix, shape (Nm,Nm)
39% The matrix of transition rates between states
40% having negative fluid rates
41% precision : double, optional
42% Numerical precision for computing the fundamental
43% matrix. The default value is 1e-14
44%
45% Returns
46% -------
47% mass0 : matrix, shape (1,Np+Nm)
48% The stationary probability vector of zero level
49% ini : matrix, shape (1,Np)
50% The initial vector of the stationary density
51% K : matrix, shape (Np,Np)
52% The matrix parameter of the stationary density
53% clo : matrix, shape (Np,Np+Nm)
54% The closing matrix of the stationary density
55
56function [mass0, ini, K, clo] = FluidSolve (Fpp, Fpm, Fmp, Fmm, prec)
57
58 if ~exist('prec','var')
59 prec = 1e-14;
60 end
61
62 [Psi, K, U] = FluidFundamentalMatrices (Fpp, Fpm, Fmp, Fmm, 'PKU', prec);
63 mass0 = CTMCSolve(U);
64 nr = sum(mass0) + 2*sum(mass0*Fmp*inv(-K));
65 mass0 = mass0 / nr;
66 ini = mass0 * Fmp;
67 clo = [eye(size(Fpp,1)), Psi];
68 mass0 = [zeros(1,size(Fpp,1)), mass0];
69end
70