% plot_specgram.m % David Rowe May 2017 % % As the name suggests..... function S = plot_specgram(x, Fs=8000, fmin, fmax) step = fix(20*Fs/1000); # one spectral slice every 5 ms window = fix(160*Fs/1000); # 40 ms data window fftn = 2^nextpow2(window); # next highest power of 2 [S, f, t] = specgram(x, fftn, Fs, window, window-step); S = abs(S(2:fftn/2,:)); # magnitude in range 0 2 axis([0 max(t) fmin fmax]) end xlabel('Time (s)'); ylabel('Freq (Hz)'); endfunction