MATLAB: Viewing spectrum of an audio signal in matlab

Signal Processing Toolboxurgent

Hello all,
I have an audio signal (.wav) and would like to view its spectrum in matlab. Can anybody help me in this manner?
Thanks in advance.

Best Answer

Read it in with wavread()
[signal,fs] = wavread('file.wav');
If signal is Nx2 (two columns), extract one of them
signal = signal(:,1);
If you have the Signal Processing Toolbox, enter
plot(psd(spectrum.periodogram,signal,'Fs',fs,'NFFT',length(signal)));
Related Question