Inertial Sensor Noise Analysis With Varying Frequency

6 次查看(过去 30 天)
I have been attempting to analyze the noise of a gyroscope through the Allan Variance tutorial available here.
Unfortunately my sensor does have the configuration capability to configure its sample rate to 100 Hz as is used in the tutorial, so I must make some changes to analyze my raw data at the 250 Hz sample rate. In the tutorial, I am curious how "maxNumM" is calculated. Does this number need to be set equal to 250 in my use case? Here is the code in the tutorial that I am referring to:
maxNumM = 100;
L = size(theta, 1);
maxM = 2.^floor(log2(L/2));
m = logspace(log10(1), log10(maxM), maxNumM).';
m = ceil(m); % m must be an integer.
m = unique(m); % Remove duplicates.
tau = m*t0;
avar = zeros(numel(m), 1);
for i = 1:numel(m)
mi = m(i);
avar(i,:) = sum( ...
(theta(1+2*mi:L) - 2*theta(1+mi:L-mi) + theta(1:L-2*mi)).^2, 1);
end
avar = avar ./ (2*tau.^2 .* (L - 2*m));
Thank you in advance for looking into my question!

采纳的回答

William Rose
William Rose 2023-9-18
编辑:William Rose 2023-9-18
[edit: fix typos]
You do not have to set maxNumM=250 just because your sampling rate is 250 Hz rather than 100 Hz. You can leave
maxNumM=100;
It is just a coincidence that maxNumM=Fs in the example.
maxNumM is how many different averaging times there will be in the analysis. The actual numer of different averaging times will be a bit smaller than maxNumM, because the averaging time must be an integer number of samples, and with logartihmically-distributed averaging times, there would be some duplicates, so after you remove the duplicates, there are fewer than maxNumM remaining. In the exaple case, the original gyro signal has 2.16e6 samples. The max averaging time should be the largest power of 2 that is less than or equal to half the number of samples. In the example, that means maxM=2^20=1048576. By choosing maxNumM=100, it means there wil be 100 different durations used to measure variance. The durations (vector m) are equally spaced on a log scale from 1 sample to maxM samples. This means m=[1, 1.15, 1.32, 1.52, ..., 792499.6, 911561.1, 1048576], in the example case. Then each duration is rounded up: m=[1, 2, 2, 2, ..., 792500, 911562, 1048576]. Vector m still has maxNumM=100 elements at this point. The duplicates are removed: m=[1, 2, 3, ..., 792500, 911562, 1048576]. Now vector m has 93 elements, and it stays that way for the rest of the Allan variance analysis.
  4 个评论
Gaetano
Gaetano 2024-3-11
Hi can you elaborate on the reason behind this: "The max averaging time should be the largest power of 2 that is less than or equal to half the number of samples." ?
William Rose
William Rose 2024-3-12
The Allan Variance is a meassure of variability based on samples of different duirations. The longest duration should be, at most, half the duration of the signal. This is because one needs at least two measurements to estimate the variability of the measurement. I do not know why it must be a power-of-two number of samples.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by