Commit c4b4eae8c4b21936212c6fb0b0ea48babdd1dc6d

Authored by bmarechal
1 parent 5f5b4d55d2
Exists in master

psdplot.m: add n-diff arg

Showing 1 changed file with 2 additions and 1 deletions Inline Diff

#!/usr/bin/octave-cli --persist 1 1 #!/usr/bin/octave-cli --persist
2 2
filename = argv(){1}; 3 3 filename = argv(){1};
col = eval(argv(){2}); 4 4 col = eval(argv(){2});
mult = eval(argv(){3}); 5 5 mult = eval(argv(){3});
data.rate = eval(argv(){4}); 6 6 data.rate = eval(argv(){4});
7 d = eval(argv(){5});
7 8
if length(col) == length(mult) 8 9 if length(col) == length(mult)
figure 9 10 figure
hold all 10 11 hold all
grid on 11 12 grid on
cc = 'bkcgmry'; 12 13 cc = 'bkcgmry';
for i = [1:length(col)] 13 14 for i = [1:length(col)]
data.freq = load(filename)(:,col(i)).*mult(i); 14 15 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'); 15 16 [p, f] = pwelch(data.freq, hanning(length(data.freq)/1), 0.5, [], data.rate, 'onesided', 'power');
semilogx(f, 10*log10(p), cc(mod(i, length(cc)))) 16 17 semilogx(f, 10*log10(p), cc(mod(i, length(cc))))
leg{i} = strcat(filename, ' col', num2str(col(i))); 17 18 leg{i} = strcat(filename, ' col', num2str(col(i)));
hold on 18 19 hold on
end 19 20 end
legend(leg) 20 21 legend(leg)
input("Press to continue..."); 21 22 input("Press to continue...");
end 22 23 end