1% =========================================================================== %
3%> the noise parameters of a given measurement.
5%> @param meas - the measurement data (Mxu vector) [unit: any = X, e.g. m/s^2]
6%> @param fs - the sampling frequency of the measurement (scalar) [unit: Hz]
7%> @param plt - a flag to plot the Allan deviation (logical)
9%> @retval tau - the time intervals used
for Allan deviation calculation (Mxu vector) [unit: s]
10%> @retval adev - the Allan deviation values corresponding to each tau (Mxu vector) [unit: X, e.g. m/s^2]
11%> @retval N - the noise density factor (1xu vector) [unit: X/sqrt(Hz), e.g. (m/s^2)/sqrt(Hz)]
12%> @retval K - the random walk coefficient (1xu vector) [unit: X * sqrt(Hz), e.g. (m/s^2) * sqrt(Hz)]
13%> @retval B - the bias instability coefficient (1xu vector) [unit: X, e.g. m/s^2]
14%> @retval tau_B - the time interval where the bias instability coefficient is estimated (1xu vector) [unit: s]
16%> The implementation is based on the following references:
18%> - IEEE Standard Specification Format Guide and Test Procedure
for Single-Axis Laser Gyros, IEEE Std 647-2006
22%> @copyright see the file @ref LICENSE in the root directory of the repository
23% =========================================================================== %
27 meas (:,:) double {mustBeNumeric}
28 fs (1,1) double {mustBeNumeric}
31% calculate Allan variance
32[avar, tau] = allanvar(meas,
'octave', fs);
34% remove last element of tau and avar (because we have very
long measurements)
36avar = avar(1:end-1,:);
38% calculate Allan deviation
47% find Noise Parameters
50dlogadev = diff(logadev) ./ diff(logtau);
54 % first, find the global minimum of the Allan deviation
55 [~, idx_min] = min(adev(1:end-1,i));
57 % find Noise Density N (must be left of the minimum of the Allan deviation curve)
59 [~, idxN] = min(abs(dlogadev(1:idx_min,i) - slope));
60 b = logadev(idxN,i) - slope * logtau(idxN); % find y-intercept
61 logN = slope * log10(1) + b;
62 N(i) = 10^logN; % Noise Density Factor N [unit: X/sqrt(Hz), e.g. (m/s^2)/sqrt(Hz)]
64 % find Random Walk Coefficient K (must be right of the minimum of the Allan deviation curve)
66 [~, idxK] = min(abs(dlogadev(idx_min:end,i) - slope));
67 idxK = idxK + idx_min - 1; % correct index
68 b = logadev(idxK,i) - slope * logtau(idxK); % find y-intercept
69 logK = slope * log10(3) + b;
70 K(i) = 10^logK; % Random Walk Coefficient K [unit: X * sqrt(Hz), e.g. (m/s^2) * sqrt(Hz)]
72 % find bias instability Coefficient B (must be between idxN and idxK)
74 [~, idxB] = min(abs(dlogadev(idxN:idxK,i) - slope));
75 idxB = idxB + idxN - 1; % correct index
76 b = logadev(idxB,i) - slope * logtau(idxB); % find y-intercept
77 scfB = sqrt(2*log(2)/pi);
78 logB = b - log10(scfB);
79 B(i) = 10^logB; % bias instability Coefficient B [unit: X, e.g. m/s^2]
function allanDeviationAnalysis(in meas, in fs)