From 45d0ff1faee2db4473e32a73092fc26831a1af78 Mon Sep 17 00:00:00 2001 From: bma Date: Tue, 17 Oct 2017 21:58:59 +0200 Subject: [PATCH] compute PSD from temporal datafile --- psdplot.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 psdplot.m diff --git a/psdplot.m b/psdplot.m new file mode 100755 index 0000000..5ec39d1 --- /dev/null +++ b/psdplot.m @@ -0,0 +1,23 @@ +#!/usr/bin/octave-cli --persist + +filename = argv(){1}; +col = eval(argv(){2}); +mult = eval(argv(){3}); + +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; + [p, f] = pwelch(data.freq, [], 0.95, [], data.rate.*mult(i), 'onesided'); + 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..."); +end +exit -- 2.16.4