LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
LagCorrelationsFromRAP.m
1% acf = LagCorrelationsFromRAP(H0, H1, L, prec)
2%
3% Returns the lag autocorrelations of a rational arrival
4% process.
5%
6% Parameters
7% ----------
8% H0 : matrix, shape (M,M)
9% The H0 matrix of the rational arrival process
10% H1 : matrix, shape (M,M)
11% The H1 matrix of the rational arrival process
12% L : double, optional
13% The number of lags to compute. The default value is 1
14% prec : double, optional
15% Numerical precision to check if the input is valid.
16% The default value is 1e-14
17%
18% Returns
19% -------
20% acf : column vector of doubles, length (L)
21% The lag autocorrelation function up to lag L
22%
23
24function acf = LagCorrelationsFromRAP (H0, H1, L)
25
26 global BuToolsCheckInput;
27 if isempty(BuToolsCheckInput)
28 BuToolsCheckInput = true;
29 end
30
31 if BuToolsCheckInput && ~CheckRAPRepresentation(H0,H1)
32 error('LagCorrelationsFromRAP: input isn''t a valid MAP representation!');
33 end
34
35 if ~exist('L','var')
36 L=1;
37 end
38
39 H0i = inv(-H0);
40 P = H0i*H1;
41 pi = DRPSolve(P);
42 moms = MomentsFromME(pi, H0, 2);
43 pi = pi * H0i * P;
44
45 acf = zeros(1,L);
46 for i=1:L
47 acf(i) = (sum(pi*H0i) - moms(1)^2) / (moms(2) - moms(1)^2);
48 pi = pi * P;
49 end
50end
51