Commit 54ec4ada0b07134e4185b0670d7b394cbe58c671
1 parent
4a63914c1d
Exists in
master
add help header
Showing 1 changed file with 19 additions and 3 deletions Side-by-side Diff
allanplot.m
1 | 1 | #!/usr/bin/octave-cli --persist |
2 | 2 | |
3 | +# allanplot.m computes Allan deviation from temporal dataset | |
4 | +# | |
5 | +# use : allanplot.m file.dat column_i gain_i ad_opt | |
6 | +# allanplot.m file.dat [column_i,column_j] [gain_i,gain_j] [ad_opt_i,ad_opt_j] | |
7 | +# | |
8 | +# inputs: | |
9 | +# file.dat : [string] file to load | |
10 | +# columns : int or [int] columns to load | |
11 | +# gains : float or [float] gains to apply | |
12 | +# ad_opt : int or [int] ad options : | |
13 | +# 0 direct allan computation | |
14 | +# 1 drift removed ad | |
15 | +# 2 relative ad | |
16 | +# 3 relative drift removed ad | |
17 | + | |
3 | 18 | filename = argv(){1}; |
4 | 19 | col = eval(argv(){2}); |
5 | 20 | mult = eval(argv(){3}); |
21 | +ad_opt = eval(argv(){4}); | |
6 | 22 | |
7 | 23 | if length(col) == length(mult) |
8 | 24 | figure |
9 | 25 | |
10 | 26 | |
... | ... | @@ -12,13 +28,13 @@ |
12 | 28 | for i = [1:length(col)] |
13 | 29 | data.freq = load(filename)(:,col(i)).*mult(i); |
14 | 30 | if nargin == 4 |
15 | - if eval(argv(){4})(i) == 1 | |
31 | + if ad_opt(i) == 1 | |
16 | 32 | printf(strcat(filename, ' col', num2str(col(i)), ' drift removed\n\n')) |
17 | 33 | data.freq = detrend(data.freq); |
18 | - elseif eval(argv(){4})(i) == 2 | |
34 | + elseif ad_opt(i) == 2 | |
19 | 35 | printf(strcat(filename, ' col', num2str(col(i)), ' relative ad : mean=', num2str(mean(data.freq)), '\n\n')) |
20 | 36 | data.freq = data.freq./mean(data.freq); |
21 | - elseif eval(argv(){4})(i) == 3 | |
37 | + elseif ad_opt(i) == 3 | |
22 | 38 | printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) |
23 | 39 | data.freq = detrend(data.freq./mean(data.freq)); |
24 | 40 | end |