ad_cov.m 714 Bytes
clear all
close all
clc

N = 1e5;
Ts = 1;

dc.rate = Ts;
d1.rate = Ts;
d2.rate = Ts;
dd.rate = Ts;

r = 10;

com = noise(N, 1, 'brown');
n1 = r.*noise(N, 1, 'brown');
n2 = r.*noise(N, 1, 'brown');

dc.freq = com;
d1.freq = com.+n1;
d2.freq = com.+n2;
dd.freq = d1.freq;
dd.freq2 = d2.freq;

[ad_dc, S, err_dc, tau_dc] = allan(dc,2.^[0:20],'dc',0);
[ad_d1, S, err_d1, tau_d1] = allan(d1,2.^[0:20],'d1',0);
[ad_d2, S, err_d2, tau_d2] = allan(d2,2.^[0:20],'d2',0);
[ad_dd, S, err_dd, tau_dd] = allan_cov(dd,2.^[0:20],'dd',0);

figure
hold on
loglogerr(tau_dc, ad_dc, err_dc, 'mo')
loglogerr(tau_d1, ad_d1, err_d1, 'b')
loglogerr(tau_d2, ad_d2, err_d2, 'r')
loglogerr(tau_dd, ad_dd, err_dd, 'k')
grid on

ad_dd./ad_dc