[y,fs,bits]=wavread('E:\MATLA\work\hnist.wav');
sound(y,fs,bits); %回放该音频
Y=fft(y,4096); %进行傅立叶变换
subplot(2,1,1);
plot(y);
title('声音信号的波形');
subplot(2,1,2)
plot(abs(Y));
title('声音信号的频谱');
[y,Fs]=wavread('hnist.wav');
y=y(:,1);
sigLength=length(y);
Y = fft(y,sigLength);
Pyy = Y.* conj(Y) / sigLength;
halflength=floor(sigLength/2);
f=Fs*(0:halflength)/sigLength;
subplot(222);plot(f,Pyy(1:halflength+1));xlabel('Frequency(Hz)'); %频域图像
t=(0:sigLength-1)/Fs;
subplot(221);plot(t,y);xlabel('Time(s)'); %时域图像