From 2f13b73569577e6baf7085cc4b9b9ac366408254 Mon Sep 17 00:00:00 2001 From: bma Date: Tue, 17 Oct 2017 21:59:33 +0200 Subject: [PATCH] add multiple column option --- allanplot.m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/allanplot.m b/allanplot.m index 613c56a..441f8eb 100755 --- a/allanplot.m +++ b/allanplot.m @@ -4,9 +4,20 @@ filename = argv(){1}; col = eval(argv(){2}); mult = eval(argv(){3}); -data.freq = load(filename)(:,col).*mult; -data.rate = 1; - -ad = allan(data, 2.^(0:nextpow2(length(data.freq))), strsplit(filename, '/'){end}, 1); -input("Press to continue..."); +if length(col) == length(mult) + figure + hold all + grid on + cc = 'bkcgmry'; + for i = [1:length(col)] + data.freq = load(filename)(:,col(i)).*mult(i); + 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); + loglogerr(tau, ad, err, cc(mod(i, length(cc)))) + leg{i} = strcat(filename, ' col', num2str(col(i))); + hold on + end + legend(leg) + input("Press to continue..."); +end exit -- 2.16.4