fft - Octave (Matlab): Spectrum calculation -
another question spectrum calculation in octave using fft:
with audacity created .wav file containing white noise, filtered lowpass fcut = 1khz, -20db/decade. spectrum analysed audacity looks expected (unfortunately can't post image since don't have enough reputation)
then analysed spectrum octave using following code:
pkg load signal %load signal package graphics_toolkit ("gnuplot") % use gnuplots close clear [stereosig, fs,bit] =wavread('noise_stereo.wav'); % load wav ch1 = stereosig(:,1); % left ch2 = stereosig(:,2); % right nfft = 1024; nfft_half = nfft/2; x = fft(ch1, nfft); freqvect = (1:nfft_half+1)./nfft*fs; figure(1) x_mag_scaled = abs(x(1:nfft_half+1)./nfft_half); semilogx(freqvect, 20*log10(x_mag_scaled)); grid on xlabel('frequency (hz)') ylabel('mag [db]')
the plot produced octave extremly "unsmooth", -20db/decade can not recognised since difference between 2 adjacent points can > 10db or so. 1khz cut off frequency can guessed.
does have idea how "smooth" spectrum done in audacity (which suppose reasonable solution)?
philippe
Comments
Post a Comment