Guidance, Navigation and Control · Theory · M6
M6-T2 — Allan Variance: Reading a Sensor from Its Noise
A gyro data sheet gives a few numbers. Allan variance is the way to read them off a record, and the way to check whether the data sheet is true.
The error model of the last lesson has white noise and a wandering bias, and a navigation filter needs the size of each. A static record of the sensor contains both, mixed together. The Allan variance separates them by averaging the record over different times and looking at how the scatter changes: white noise averages down, wandering does not. This lesson computes the Allan deviation of a record with known coefficients, reads them from the slopes, and shows how well the reading works and where it does not.
Learning objectives
After this lesson, you should be able to:
- Compute the overlapping Allan deviation of a static gyro record at a set of averaging times.
- Read the angle random walk from the value at 1 s and the bias instability from the minimum.
- Recognize the three standard slopes on a log-log plot and the noise each belongs to.
- State how many independent clusters a coefficient estimate rests on and what its error is.
The intuition
The Probability track's identifying noise parameters from data fits a model to residuals, and distributions of real sensor noise shows what real noise looks like. The inertial case has a specific difficulty that this lesson solves: the sensor has a white part and a slowly wandering part, and a plain variance of the record cannot tell them apart.
Average, and see what survives
Take a gyro at rest for an hour. Its output is not zero: it has white noise that changes every sample, a bias that wanders over minutes, and a still slower drift. Split the record into clusters of length τ, average the output in each cluster, and compare neighbouring clusters. If the noise is white, long clusters average it down, so the scatter of neighbouring averages falls like . If the error is a slow drift, neighbouring clusters share most of it and differ by an amount that rises with τ. The Allan deviation is the root-mean-square difference of neighbouring cluster averages, divided by √2, as a function of τ.
Three slopes, three noises
On log-log axes the plot has a V-shaped look. The left arm, with a slope of −1/2, is white noise on the rate, called angle random walk because integrating it gives an angle that random-walks. The bottom is the point where averaging stops helping: the bias instability, the best a very long averaging can achieve. The right arm, with a slope of +1/2, is a random walk of the rate itself, rate random walk, which grows with time. The figure shows the result for a simulated hour at 10 Hz whose true coefficients were chosen in advance: the left arm gives 0.0100 °/√s against a true 0.0100, the minimum at about 100 s gives a bias instability reading of 6.3 °/h.
The Allan deviation turns a record into three numbers. The value at 1 s is the angle random walk. The minimum is the bias instability. The rising arm is the rate random walk. Each is read where its noise dominates, and each has an error that depends on the number of independent clusters.
Definitions
- Cluster average
- The mean of the gyro output over the k-th cluster of length .
- Allan deviation
- Half the mean square difference of successive cluster averages, square-rooted; a function of the averaging time.
- Angle random walk (ARW)
- White noise on the rate. Units: °/√s or, as on data sheets, °/√h.
- Bias instability (BI)
- The flat bottom of the Allan curve, the floor of the best averaged estimate of the bias. Units: °/h.
- Rate random walk (RRW)
- A random walk of the rate: its derivative is white noise. Units: °/s/√s.
Derivation: why white noise gives a slope of −1/2 and a random walk +1/2
The Allan variance in terms of the cluster averages, then for each of the two pure noises.
The definition: half the expected squared difference of neighbouring cluster averages. The factor 1/2 makes the result equal the ordinary variance for white noise of unit variance in each cluster.
For white noise on the rate with angle random walk N, the variance of an average over τ falls as 1/τ (the rate of the white noise has spectral density ).
Neighbouring averages of white noise are independent, so the variance of their difference is twice the variance of one. The result has a log-log slope of −1/2, and .
Rate random walk
The rate is K times a Wiener process W (a random walk whose increments over time t have variance t).
Write the two cluster averages as integrals of the walk over neighbouring intervals.
Evaluate the variance of the double integral of a Wiener process (a standard result: it equals before the factor ).
With the factor 1/2 of the definition. The log-log slope is +1/2, and .
Averaging helps against white noise (variance falls as 1/τ) and hurts against a random walk (variance grows as τ). The Allan deviation is the plot of that competition, and the slopes −1/2 and +1/2 identify the two noises.
A worked example
A one-hour static gyro record at 10 Hz is simulated with known coefficients: angle random walk 0.0100 °/√s (36 °/√h), a bias process with a standard deviation of 0.0008 °/s (2.9 °/h) and a correlation time of 60 s, and a rate random walk of 10⁻⁴ °/s/√s.
- Compute. Integrate the record to an angle, then evaluate the overlapping Allan deviation at cluster lengths of 1 to 4000 samples (0.1 s to 400 s).
- Left arm. The deviation falls from 0.0317 °/s at 0.1 s to 0.0100 °/s at 1 s, with a slope of −0.51 between 0.1 s and 0.5 s. The value at 1 s is the angle random walk: 0.01002 °/√s against a true 0.0100.
- Bottom. The minimum is 0.00116 °/s at 100 s. Dividing by 0.664 gives a bias instability reading of 0.00174 °/s, which is 6.3 °/h. The true standard deviation of the bias process is 2.9 °/h, so the reading is about twice the truth.
- Right arm. The deviation rises to 0.00172 °/s at 400 s. From the last point, gives 1.5×10⁻⁴ against a true 1.0×10⁻⁴, a 49% error.
- Why the errors. The 0.664 rule is exact for flicker noise, and the record contains a Gauss-Markov bias, white noise and a random walk, each leaking into the others near the minimum. At 400 s only 9 independent clusters remain, an estimate error of about 25% by the usual formula.
- Consequence. With this angle random walk, the attitude error alone after 60 s is 0.077° and after 600 s 0.245° (1σ).
import math
# A static gyro record, 1 hour at 10 Hz, deterministic generator.
def lcg(seed):
s = seed
while True:
s = (1103515245 * s + 12345) % 2147483648
yield (s / 2147483648.0 - 0.5) * 3.4641016
fs, T = 10.0, 3600.0
dt = 1 / fs
N_true = 0.01 # angle random walk: deg / sqrt(s) (0.6 deg/sqrt-h)
Bgm = 0.0008 # Gauss-Markov bias, sigma 0.0008 deg/s (2.9 deg/h), correlation time 60 s: the flicker-like part
tc = 60.0
K_true = 1e-4 # rate random walk: deg/s / sqrt(s)
rnd = lcg(2024)
n = int(T * fs)
b = 0.0; w = 0.0
y = []
phi = math.exp(-dt / tc)
for k in range(n):
b = phi * b + Bgm * math.sqrt(1 - phi * phi) * next(rnd)
w += K_true * math.sqrt(dt) * next(rnd)
y.append(N_true / math.sqrt(dt) * next(rnd) + b + w)
# cumulative angle and the overlapping Allan variance
theta = [0.0]
for v in y:
theta.append(theta[-1] + v * dt)
def allan(m):
tau = m * dt
s = 0.0; cnt = 0
for k in range(0, n + 1 - 2 * m):
s += (theta[k + 2 * m] - 2 * theta[k + m] + theta[k]) ** 2
cnt += 1
return math.sqrt(s / (2 * tau * tau * cnt))
ms = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 3000, 4000]
print('tau (s) Allan deviation (deg/s) deg/h')
res = []
for m in ms:
a = allan(m)
res.append((m * dt, a))
print(f'{m * dt:7.1f} {a:.6f} {a * 3600:8.2f}')
# read the coefficients
tau1 = [(t, a) for t, a in res if abs(t - 1.0) < 1e-9][0][1]
print(f'angle random walk N = sigma(1 s) = {tau1:.5f} deg/sqrt(s) (true {N_true})')
tmin, amin = min(res, key=lambda r: r[1])
print(f'minimum at tau = {tmin:.1f} s, sigma = {amin:.5f} deg/s -> bias instability B = sigma_min / 0.664 = {amin / 0.664:.5f} deg/s = {amin / 0.664 * 3600:.2f} deg/h')
# slope of the first three points
slope = (math.log(res[2][1]) - math.log(res[0][1])) / (math.log(res[2][0]) - math.log(res[0][0]))
print(f'slope between 0.1 s and 0.5 s: {slope:.2f} (white noise gives -0.5)')
# rate random walk from the long-tau end: sigma(tau) = K sqrt(tau/3)
t_l, a_l = res[-1]
print(f'rate random walk from the last point: K = sigma sqrt(3/tau) = {a_l * math.sqrt(3 / t_l):.2e} deg/s/sqrt(s) (true {K_true:.0e}; the last points are shared with the bias and few independent clusters remain)')
print(f'number of independent clusters at tau = {res[-1][0]:.0f} s: {int(T / res[-1][0])}; relative error of the estimate about {100 / math.sqrt(2 * (T / res[-1][0] - 1)):.0f}%')
# consequence: angle error after a time t for the angle random walk
for t in (60.0, 600.0):
print(f'angle random walk alone after {t:.0f} s: 1 sigma {N_true * math.sqrt(t):.3f} deg')tau (s) Allan deviation (deg/s) deg/h
0.1 0.031740 114.26
0.2 0.022367 80.52
0.5 0.014079 50.69
1.0 0.010023 36.08
2.0 0.007126 25.65
5.0 0.004364 15.71
10.0 0.002936 10.57
20.0 0.001976 7.11
50.0 0.001325 4.77
100.0 0.001156 4.16
200.0 0.001284 4.62
300.0 0.001483 5.34
400.0 0.001715 6.18
angle random walk N = sigma(1 s) = 0.01002 deg/sqrt(s) (true 0.01)
minimum at tau = 100.0 s, sigma = 0.00116 deg/s -> bias instability B = sigma_min / 0.664 = 0.00174 deg/s = 6.27 deg/h
slope between 0.1 s and 0.5 s: -0.51 (white noise gives -0.5)
rate random walk from the last point: K = sigma sqrt(3/tau) = 1.49e-04 deg/s/sqrt(s) (true 1e-04; the last points are shared with the bias and few independent clusters remain)
number of independent clusters at tau = 400 s: 9; relative error of the estimate about 25%
angle random walk alone after 60 s: 1 sigma 0.077 deg
angle random walk alone after 600 s: 1 sigma 0.245 degIn robotics
Allan variance is the standard acceptance test of an inertial sensor, and the usual way an estimator's noise parameters are chosen.
- Checking a data sheet. A manufacturer quotes a bias instability and an angle random walk. A static record of a few hours and an Allan plot confirm both and show whether the sensor is quiet in your environment.
- Setting filter noise. The angle random walk and the rate random walk give the process noise of the gyro and bias states of the attitude filter of module 7. Using the bias instability as a random-walk intensity is a common and conservative choice.
- Record length. To read a coefficient at τ the record needs many clusters, so at least ten times longer than τ, and the confidence of the estimate improves with the square root of the number of clusters. A one-hour record cannot give the bias instability of a navigation-grade gyro, whose minimum is at hundreds of seconds, with confidence.
- Choosing the averaging for alignment. The minimum of the curve is the best averaging time for estimating the bias at rest, and for gyrocompassing in M6-T5: Initial Alignment: Levelling and Gyrocompassing: averaging longer than the minimum gains nothing.
- Limits. Temperature, vibration and a static record on a table are not flight. The method shows the sensor's intrinsic noise, and the in-flight noise is usually larger.
The lab M6-L1: Read the Allan Plot computes the Allan deviations of three gyros and asks which meets a heading-drift requirement.
Common misconceptions
“The Allan variance is the same as the variance of the record.”
The variance of a record dominated by a wandering bias does not converge and grows with the record length. The Allan variance depends on τ and separates the contributions, which the plain variance cannot.
“The minimum of the curve is the bias.”
It is a floor on the averaged bias error, a figure of merit, and not the size of the bias itself. In the example the reading of 6.3 °/h overstated the true 2.9 °/h of the bias process, and the constant turn-on bias does not appear in the plot at all.
“A longer record always gives a better estimate.”
It gives more clusters and a smaller estimation error, but it also includes more of the temperature and environment drift, which is not intrinsic to the sensor. Records of several hours need a thermally stable setting.
“Angle random walk is a bias.”
It is white noise on the rate and has zero mean. Its effect on the angle is a random walk whose spread grows as the square root of time, with no systematic drift.
“One slope identifies one physical source.”
The slopes identify the statistical character, not the physics. Flicker noise from the electronics, a slow thermal variation and a true random walk can look alike on a limited range of τ, so a coefficient is a model fitted to the curve.
Key takeaways
- The Allan deviation is the root-mean-square difference of neighbouring cluster averages over √2, as a function of the averaging time τ.
- White noise gives slope −1/2 and ; a rate random walk gives +1/2 and .
- The minimum is read as the bias instability, , a figure of merit.
- In the example the angle random walk was read to 0.2% (0.01002 against 0.0100), the bias to a factor of two, the rate random walk to 49%.
- A coefficient read at τ rests on about T/τ independent clusters, with a relative error near .
- The curve is for a static, quiet record; flight vibration and temperature add to it.
References and further reading
Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.
- IEEE Std 952-1997 and IEEE Std 1554-2005, the standards that define the Allan variance coefficients for gyros and accelerometers. Paid.
- Independent open-source Allan variance packages (search for "allan variance" on PyPI or GitHub) are a useful cross-check of your own code. Free to read; the licences differ between packages.
- D. W. Allan, "Statistics of atomic frequency standards", Proceedings of the IEEE 54(2), 1966, the original paper. Paid (IEEE); the abstract is free.
- N. El-Sheimy, H. Hou and X. Niu, "Analysis and modeling of inertial sensors using Allan variance", IEEE Transactions on Instrumentation and Measurement 57(1), 2008. Paid.
Knowledge check
Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A gyro Allan deviation reads 0.0100 °/s at τ = 1 s and falls with slope −1/2 to the left of it. What is the angle random walk, and what is the 1σ angle error after 100 s from it?
Explanation
On the −1/2 line σ = N/√τ, so N = σ(1 s) = 0.0100 °/√s. The angle is the integral of white noise of that size, so its standard deviation is N√t: 0.0100 × √100 = 0.10° after 100 s. The result does not include the bias, which adds an error that grows linearly with time, so the figure is a lower bound on the total attitude error after 100 s.
Question 2
An Allan plot is computed from a record of 3600 s. How many independent clusters are there at τ = 400 s, and why is the rate random walk read from there uncertain?
Explanation
There are 3600/400 = 9 clusters, which leaves 8 independent differences, and the relative error of an Allan deviation estimate is about 1/√(2(N−1)) = 25%. Beyond that, the right arm is contaminated by the bias term near the minimum, so the reading is also biased: it gave 1.5×10⁻⁴ for a true 1.0×10⁻⁴. A longer record is the only fix.
Question 3
Why can the plain variance of a gyro record not replace the Allan variance?
Explanation
The plain variance of a record with a wandering bias is not constant: it grows with the length of the record as the bias wanders further, and it mixes the white noise (which averages away) with the drift (which does not). It is a single number that depends on how long the record was. The Allan deviation is a function of the averaging time, and its slope in each region identifies which noise dominates there, so it separates what a single variance cannot.
What’s next
Related content
Nothing below is required to finish this lesson.
- BeforeM6-T1: What Inertial Sensors Measure
Explain specific force and angular rate, write the sensor error model (bias, scale factor, misalignment, noise), and relate sensor grades to their error sizes.
- LabM6-L1: Read the Allan Plot
Three gyros were logged at rest for an hour. Compute their Allan deviations, extract the noise coefficients, and pick the one that meets a heading-drift requirement.
Other courses on this site treat neighbouring topics from their own angle:
- UAV M2-T7: Inertial Navigation Systems
- UAV M2-T8: Dead reckoning and inertial drift
- UAV M3-T7: IMU noise and bias modelling
- UAV M3-T8: IMU preintegration
- UAV M1-T8: IMU, barometer, magnetometer and GNSS
- Probability M2-T4: Distributions of Real Sensor Noise
- Probability M5-T4: Identifying Noise Parameters from Data
- Linear Algebra M10-T6: Small-Angle Approximations
This course leaves the following to the pages that already teach them:
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.