Blame view

allanplot_cov.m 1.51 KB
b3b851a23   bmarechal   add cov test scripts
1
2
3
4
5
  #!/usr/bin/octave-cli --persist
  
  filename = argv(){1};
  col1 = eval(argv(){2});
  col2 = eval(argv(){3});
76682e8cb   bmarechal   allanplot_cov: ad...
6
7
8
9
10
11
  fs = eval(argv(){4});
  mult1 = eval(argv(){5});
  mult2 = eval(argv(){6});
  driftRem1 = eval(argv(){7});
  driftRem2 = eval(argv(){8});
  arg_save  = eval(argv(){9});
b3b851a23   bmarechal   add cov test scripts
12
13
  
  if length(col1) == length(mult1)
1a0e88f0c   bmarechal   replace 4-spaces ...
14
15
16
17
18
19
20
21
22
  	figure
  	hold all
  	grid on
  	cc = 'bkcgmry';
  	for i = [1:length(col1)]
  		data.freq = load(filename)(:,col1(i)).*mult1(i);
  		data.freq2 = load(filename)(:,col2(i)).*mult2(i);
  		data.freq = data.freq(1:min(length(data.freq), length(data.freq2)));
  		data.freq2 = data.freq2(1:min(length(data.freq), length(data.freq2)));
76682e8cb   bmarechal   allanplot_cov: ad...
23
  		if driftRem1 == 1
1a0e88f0c   bmarechal   replace 4-spaces ...
24
25
26
27
28
29
  			printf('
  data1 drift removed
  
  ')
  			data.freq = detrend(data.freq);
  		end
76682e8cb   bmarechal   allanplot_cov: ad...
30
  		if driftRem2 == 1
1a0e88f0c   bmarechal   replace 4-spaces ...
31
32
33
34
35
36
  			printf('
  data2 drift removed
  
  ')
  			data.freq2 = detrend(data.freq2);
  		end
76682e8cb   bmarechal   allanplot_cov: ad...
37
  		data.rate = fs(i);
5f5b4d55d   bmarechal   allanplot_cov: de...
38
  		[ad, S, err, tau] = allan_cov(data, horzcat(reshape([1:0.1:9]'.*10.^[0:round(log10(length(data.freq)))-1],1,[]), 10^(round(log10(length(data.freq)))-1))./data.rate, strcat(strsplit(filename, '/'){end}, num2str(i)), 0);
1a0e88f0c   bmarechal   replace 4-spaces ...
39
40
41
42
  		loglogerr(tau, ad, err, strcat(cc(mod(i, length(cc))), '-s'))
  		leg{i} = strcat(filename, ' cov col', num2str(col1(i)), ' col', num2str(col2(i)));
  		axis(10.^ceil(log10([tau(1), tau(end)])))
  		hold on
7ec25ad9f   bmarechal   allanplot_cov.m: ...
43
44
45
  		if arg_save ==1
  			filenameout = strcat(strsplit(filename,'.'){1},'-cov-',num2str(col1),num2str(col2),'.sig')
  			datatosave = horzcat(tau', ad', err');
146b73337   bmarechal   save long without...
46
  			save('-ascii', '-double', '-tabs', filenameout , 'datatosave');
7ec25ad9f   bmarechal   allanplot_cov.m: ...
47
  		end
1a0e88f0c   bmarechal   replace 4-spaces ...
48
49
50
  	end
  	legend(leg)
  	input("Press to continue...");
b3b851a23   bmarechal   add cov test scripts
51
52
  end
  exit