Commit bba038d1432f3db04181dbeaee758e9ef1e5f174
1 parent
505d9a5140
Exists in
master
add fs arg
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
psdplot.m
#!/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}); | |
6 | data.rate = eval(argv(){4}); | |||
6 | 7 | |||
if length(col) == length(mult) | 7 | 8 | if length(col) == length(mult) | |
figure | 8 | 9 | figure | |
hold all | 9 | 10 | hold all | |
grid on | 10 | 11 | grid on | |
cc = 'bkcgmry'; | 11 | 12 | cc = 'bkcgmry'; | |
for i = [1:length(col)] | 12 | 13 | for i = [1:length(col)] | |
data.freq = load(filename)(:,col(i)).*mult(i); | 13 | 14 | data.freq = load(filename)(:,col(i)).*mult(i); | |
data.rate = 1; | 14 | |||
[p, f] = pwelch(data.freq, [], 0.95, [], data.rate.*mult(i), 'onesided'); | 15 | 15 | [p, f] = pwelch(data.freq, [], 0.95, [], data.rate.*mult(i), 'onesided'); | |
semilogx(f, 10*log10(p), cc(mod(i, length(cc)))) | 16 | 16 | semilogx(f, 10*log10(p), cc(mod(i, length(cc)))) | |
leg{i} = strcat(filename, ' col', num2str(col(i))); | 17 | 17 | leg{i} = strcat(filename, ' col', num2str(col(i))); | |
hold on | 18 | 18 | hold on | |
end | 19 | 19 | end | |
legend(leg) | 20 | 20 | legend(leg) | |
input("Press to continue..."); | 21 | 21 | input("Press to continue..."); |