Blame view

psdplot.m 599 Bytes
45d0ff1fa   bmarechal   compute PSD from ...
1
2
3
4
5
  #!/usr/bin/octave-cli --persist
  
  filename = argv(){1};
  col = eval(argv(){2});
  mult = eval(argv(){3});
bba038d14   bmarechal   add fs arg
6
  data.rate = eval(argv(){4});
c4b4eae8c   bmarechal   psdplot.m: add n-...
7
  d = eval(argv(){5});
45d0ff1fa   bmarechal   compute PSD from ...
8
9
  
  if length(col) == length(mult)
1a0e88f0c   bmarechal   replace 4-spaces ...
10
11
12
13
14
  	figure
  	hold all
  	grid on
  	cc = 'bkcgmry';
  	for i = [1:length(col)]
c4b4eae8c   bmarechal   psdplot.m: add n-...
15
  		data.freq = diff(load(filename)(:,col(i)).*mult(i), d)*data.rate**d;
601f6548f   bmarechal   use power spectra...
16
  		[p, f] = pwelch(data.freq, hanning(length(data.freq)/1), 0.5, [], data.rate, 'onesided', 'power');
1a0e88f0c   bmarechal   replace 4-spaces ...
17
18
19
20
21
22
  		semilogx(f, 10*log10(p), cc(mod(i, length(cc))))
  		leg{i} = strcat(filename, ' col', num2str(col(i)));
  		hold on
  	end
  	legend(leg)
  	input("Press to continue...");
45d0ff1fa   bmarechal   compute PSD from ...
23
24
  end
  exit