signal processing - Matlab Power Spectrum Plot -
i want make plot of power spectrum of particular .wav sound file, on frequency range -2000 +2000 hz.
attempt:
this code far:
[s, fs] = wavread('chord.wav'); hs=spectrum.periodogram; psd(hs,s,'fs',fs)
i tried using periodogram algorithm. resulting plot ranged 0 20,000 hz. so, how can modify code plotted on -2000 +2000 hz instead?
any appreciated.
i modified 1 of examples in support page
fs = 32e3; t = 0:1/fs:2.96; x = cos(2*pi*t*1.24e3)+ cos(2*pi*t*10e3)+ randn(size(t)); nfft = 2^nextpow2(length(x)); pxx = abs(fft(x,nfft)).^2/length(x)/fs; hpsd = dspdata.psd(pxx(1:length(pxx)/2),'fs',fs); plot(hpsd)
figure plot(hpsd) axis([9.8 10.2 -90 0]) %change axis range
Comments
Post a Comment