Commit 3124193a363a72e19ea3829623ede01182db9c08
1 parent
6ce4bbcc4e
Exists in
master
allanplot.m: add detrend option
Showing 1 changed file with 4 additions and 0 deletions Inline Diff
allanplot.m
#!/usr/bin/octave-cli --persist | 1 | 1 | #!/usr/bin/octave-cli --persist | |
2 | 2 | |||
filename = argv(){1}; | 3 | 3 | filename = argv(){1}; | |
col = eval(argv(){2}); | 4 | 4 | col = eval(argv(){2}); | |
mult = eval(argv(){3}); | 5 | 5 | mult = eval(argv(){3}); | |
6 | 6 | |||
if length(col) == length(mult) | 7 | 7 | if length(col) == length(mult) | |
figure | 8 | 8 | figure | |
hold all | 9 | 9 | hold all | |
grid on | 10 | 10 | grid on | |
cc = 'bkcgmry'; | 11 | 11 | cc = 'bkcgmry'; | |
for i = [1:length(col)] | 12 | 12 | for i = [1:length(col)] | |
data.freq = load(filename)(:,col(i)).*mult(i); | 13 | 13 | data.freq = load(filename)(:,col(i)).*mult(i); | |
14 | if eval(argv(){4})(i) == 1 | |||
15 | printf(strcat(filename, ' col', num2str(col(i)), ' drift removed\n\n')) | |||
16 | data.freq = detrend(data.freq); | |||
17 | end | |||
data.rate = 1; | 14 | 18 | data.rate = 1; | |
[ad, S, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, strcat(strsplit(filename, '/'){end}, num2str(i)), 0); | 15 | 19 | [ad, S, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, strcat(strsplit(filename, '/'){end}, num2str(i)), 0); | |
loglogerr(tau, ad, err, strcat(cc(mod(i, length(cc))), '-s')) | 16 | 20 | loglogerr(tau, ad, err, strcat(cc(mod(i, length(cc))), '-s')) | |
leg{i} = strcat(filename, ' col', num2str(col(i))); | 17 | 21 | leg{i} = strcat(filename, ' col', num2str(col(i))); | |
axis(10.^ceil(log10([tau(1), tau(end)]))) | 18 | 22 | axis(10.^ceil(log10([tau(1), tau(end)]))) | |
hold on | 19 | 23 | hold on | |
end | 20 | 24 | end | |
legend(leg) | 21 | 25 | legend(leg) | |
input("Press to continue..."); | 22 | 26 | input("Press to continue..."); |