diff --git a/psdplot.m b/psdplot.m index b43eb8f..0c68518 100755 --- a/psdplot.m +++ b/psdplot.m @@ -13,7 +13,7 @@ if length(col) == length(mult) cc = 'bkcgmry'; for i = [1:length(col)] data.freq = diff(load(filename)(:,col(i)).*mult(i), d)*data.rate**d; - [p, f] = pwelch(data.freq, hanning(length(data.freq)/1), 0.5, [], data.rate, 'onesided', 'power'); + [p, f] = pwelch(data.freq, hanning(length(data.freq)/100), 0.5, [], data.rate, 'onesided', 'power'); semilogx(f, 10*log10(p), cc(mod(i, length(cc)))) leg{i} = strcat(filename, ' col', num2str(col(i))); hold on diff --git a/temp2allan.m b/temp2allan.m index 73c511e..d406150 100755 --- a/temp2allan.m +++ b/temp2allan.m @@ -12,18 +12,16 @@ ad_opt = eval(argv(){4}); if length(col) == length(mult) for i = [1:length(col)] data.freq = load(filename)(:,col(i)).*mult(i); - if nargin == 4 - if ad_opt(i) == 1 - printf(strcat(filename, ' col', num2str(col(i)), ' drift removed\n\n')) - 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)); - end - endif + if ad_opt(i) == 1 + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed\n\n')) + 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)); + end 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); ad_tosave{i} = vertcat(ad, err)';