Commit 419afee41de074fe70b4594a7f9882bf6b682dba
1 parent
bba038d143
Exists in
master
hanning windowing with 0.5 overlapping
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}); | |
data.rate = eval(argv(){4}); | 6 | 6 | data.rate = eval(argv(){4}); | |
7 | 7 | |||
if length(col) == length(mult) | 8 | 8 | if length(col) == length(mult) | |
figure | 9 | 9 | figure | |
hold all | 10 | 10 | hold all | |
grid on | 11 | 11 | grid on | |
cc = 'bkcgmry'; | 12 | 12 | cc = 'bkcgmry'; | |
for i = [1:length(col)] | 13 | 13 | for i = [1:length(col)] | |
data.freq = load(filename)(:,col(i)).*mult(i); | 14 | 14 | data.freq = load(filename)(:,col(i)).*mult(i); | |
[p, f] = pwelch(data.freq, [], 0.95, [], data.rate.*mult(i), 'onesided'); | 15 | 15 | [p, f] = pwelch(data.freq, hanning(length(data.freq)/8), 0.5, [], data.rate, '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..."); | |
end | 22 | 22 | end |