From b25b94030b78cee35878078f152443520fb60a5c Mon Sep 17 00:00:00 2001 From: bma Date: Mon, 7 May 2018 14:14:45 +0200 Subject: [PATCH] add fs arg and replace spaces with tabs --- allanplot.m | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/allanplot.m b/allanplot.m index 90cd043..2803df3 100755 --- a/allanplot.m +++ b/allanplot.m @@ -8,6 +8,7 @@ # inputs: # file.dat : [string] file to load # columns : int or [int] columns to load +# fs : int or [int] sampling frequency # gains : float or [float] gains to apply # ad_opt : int or [int] ad options : # 0 direct allan computation @@ -17,8 +18,9 @@ filename = argv(){1}; col = eval(argv(){2}); -mult = eval(argv(){3}); -ad_opt = eval(argv(){4}); +fs = eval(argv(){3}); +mult = eval(argv(){4}); +ad_opt = eval(argv(){5}); if length(col) == length(mult) figure @@ -33,13 +35,13 @@ if length(col) == length(mult) data.freq = detrend(data.freq); elseif ad_opt(i) == 2 printf(strcat(filename, ' col', num2str(col(i)), ' relative ad : mean=', num2str(mean(data.freq)), '\n\n')) - data.freq = data.freq./mean(data.freq); - elseif ad_opt(i) == 3 - printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) - data.freq = detrend(data.freq./mean(data.freq)); + data.freq = data.freq./mean(data.freq); + elseif ad_opt(i) == 3 + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) + data.freq = detrend(data.freq./mean(data.freq)); end endif - data.rate = 1; + data.rate = fs(i); [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')) leg{i} = strcat(filename, ' col', num2str(col(i))); -- 2.16.4