1function [meanAoI, varAoI, peakAoI] = aoi_fcfs_mm1(lambda, mu)
2%AOI_FCFS_MM1 Mean, variance, and peak AoI
for M/M/1 FCFS queue
4% [meanAoI, varAoI, peakAoI] = aoi_fcfs_mm1(lambda, mu)
6% Computes the Age of Information metrics
for an M/M/1 queue with
7% First-Come First-Served (FCFS) discipline.
10% lambda (
double): Arrival rate (Poisson arrivals)
11% mu (double): Service rate (exponential service)
14% meanAoI (double): Mean (average) Age of Information
15% varAoI (double): Variance of Age of Information
16% peakAoI (double): Mean Peak Age of Information
18% Formulas (from Inoue et al., IEEE Trans. IT, 2019):
19% Mean AoI: E[A] = (1/mu) * (1 + 1/rho + rho^2/(1-rho))
20% Peak AoI: E[Apeak] = (1/mu) * (1 + 1/rho + rho/(1-rho))
23% Y. Inoue, H. Masuyama, T. Takine, T. Tanaka,
"A General Formula for
24% the Stationary Distribution of the Age of Information and Its
25% Application to Single-Server Queues," IEEE Trans. Information Theory,
26% vol. 65, no. 12, pp. 8305-8324, 2019.
28% See also: aoi_lcfspr_mm1, aoi_fcfs_mgi1, aoi_optimal_rate
30% Copyright (c) 2012-2026, Imperial College London
35 line_error(mfilename,
'Arrival rate lambda must be positive');
38 line_error(mfilename,
'Service rate mu must be positive');
46 line_error(mfilename,
'System unstable: rho = lambda/mu = %.4f >= 1', rho);
49% Mean AoI (Proposition 1 / Corollary from Section III-A)
50% E[A] = (1/mu) * (1 + 1/rho + rho^2/(1-rho))
51% = (1/mu) * (1 + mu/lambda + rho^2/(1-rho))
52meanAoI = (1/mu) * (1 + 1/rho + rho^2/(1-rho));
55% E[Apeak] = E[T] + E[Y] where T
is system time, Y
is interarrival time
56% For M/M/1: E[T] = 1/(mu-lambda), E[Y] = 1/lambda
57% E[Apeak] = 1/(mu-lambda) + 1/lambda = (1/mu) * (1/rho + 1/(1-rho))
58% = (1/mu) * (1 + 1/rho + rho/(1-rho))
59peakAoI = (1/mu) * (1 + 1/rho + rho/(1-rho));
62% From the paper, the second moment can be derived from the LST.
63% For M/M/1 FCFS,
using results from Section III-A:
64% E[A^2] can be computed from -d^2/ds^2 A*(s)|_{s=0}
66% The variance
is computed
using the known formula:
67% Var[A] = E[A^2] - (E[A])^2
69% For M/M/1 FCFS,
using the closed-form results:
70% Second moment: E[A^2] = 2/mu^2 * (1/rho^2 + 1/rho + rho^2/(1-rho)^2 + 1/(1-rho))
72E_A2 = (2/mu^2) * (1/rho^2 + 1/rho + rho^2/(1-rho)^2 + 1/(1-rho) + rho/(1-rho));
75% Ensure non-negative variance (numerical safety)