Commit b25b94030b78cee35878078f152443520fb60a5c
1 parent
419afee41d
Exists in
master
add fs arg and replace spaces with tabs
Showing 1 changed file with 9 additions and 7 deletions Side-by-side Diff
allanplot.m
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | # inputs: |
| 9 | 9 | # file.dat : [string] file to load |
| 10 | 10 | # columns : int or [int] columns to load |
| 11 | +# fs : int or [int] sampling frequency | |
| 11 | 12 | # gains : float or [float] gains to apply |
| 12 | 13 | # ad_opt : int or [int] ad options : |
| 13 | 14 | # 0 direct allan computation |
| ... | ... | @@ -17,8 +18,9 @@ |
| 17 | 18 | |
| 18 | 19 | filename = argv(){1}; |
| 19 | 20 | col = eval(argv(){2}); |
| 20 | -mult = eval(argv(){3}); | |
| 21 | -ad_opt = eval(argv(){4}); | |
| 21 | +fs = eval(argv(){3}); | |
| 22 | +mult = eval(argv(){4}); | |
| 23 | +ad_opt = eval(argv(){5}); | |
| 22 | 24 | |
| 23 | 25 | if length(col) == length(mult) |
| 24 | 26 | figure |
| 25 | 27 | |
| ... | ... | @@ -33,13 +35,13 @@ |
| 33 | 35 | data.freq = detrend(data.freq); |
| 34 | 36 | elseif ad_opt(i) == 2 |
| 35 | 37 | printf(strcat(filename, ' col', num2str(col(i)), ' relative ad : mean=', num2str(mean(data.freq)), '\n\n')) |
| 36 | - data.freq = data.freq./mean(data.freq); | |
| 37 | - elseif ad_opt(i) == 3 | |
| 38 | - printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) | |
| 39 | - data.freq = detrend(data.freq./mean(data.freq)); | |
| 38 | + data.freq = data.freq./mean(data.freq); | |
| 39 | + elseif ad_opt(i) == 3 | |
| 40 | + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) | |
| 41 | + data.freq = detrend(data.freq./mean(data.freq)); | |
| 40 | 42 | end |
| 41 | 43 | endif |
| 42 | - data.rate = 1; | |
| 44 | + data.rate = fs(i); | |
| 43 | 45 | [ad, S, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, strcat(strsplit(filename, '/'){end}, num2str(i)), 0); |
| 44 | 46 | loglogerr(tau, ad, err, strcat(cc(mod(i, length(cc))), '-s')) |
| 45 | 47 | leg{i} = strcat(filename, ' col', num2str(col(i))); |