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) 

enter image description here

figure plot(hpsd) axis([9.8 10.2 -90 0])  %change axis range 

enter image description here


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -