LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
DMAP2FromMoments.m
1% [D0, D1] = DMAP2FromMoments(moms, corr1)
2%
3% Returns a discrete MAP(2) which has the same 3 marginal
4% moments and lag-1 autocorrelation as given.
5%
6% Parameters
7% ----------
8% moms : vector, length(3)
9% First three marginal moments of the inter-arrival times
10% corr1 : double
11% The lag-1 autocorrelation of the inter-arrival times
12%
13% Returns
14% -------
15% D0 : matrix, shape (2,2)
16% The D0 matrix of the discrete MAP(2)
17% D1 : matrix, shape (2,2)
18% The D1 matrix of the discrete MAP(2)
19%
20% Notes
21% -----
22% Raises an exception if the moments are not feasible with
23% a DMAP(2). This procedure calls :func:`butools.dmap.DRAPFromMoments`
24% followed by :func:`butools.dmap.CanonicalFromDMAP2`.
25%
26
27function [D0, D1] = DMAP2FromMoments (moms, corr1)
28
29 Nm = [1, moms(1); moms(1), corr1*(moms(2)-moms(1)^2)+moms(1)^2];
30 [H0, H1] = DRAPFromMoments (moms, Nm);
31
32 global BuToolsCheckInput;
33
34 if isempty(BuToolsCheckInput)
35 BuToolsCheckInput = true;
36 end
37
38 oldCheckInput = BuToolsCheckInput;
39 BuToolsCheckInput = false;
40
41 [D0, D1] = CanonicalFromDMAP2 (H0, H1);
42
43 BuToolsCheckInput = oldCheckInput;
44end