[x,fs,bits]=wavread(‘d.wav‘, [1 5000]);
% sound(x, fs, bits);
N = length(x);
n = 0 : N-1;
t = n/fs;
% x = x
y = fft(x, N);
mag = abs(y);
f = n * fs / N;
subplot(211);
plot(t, x);
xlabel(‘Time (sec.)‘) % 标注横坐标
ylabel(‘Signal Level (Volts)‘) % 标注纵坐标
grid on
subplot(212);
fn = 1:N/2;
plot(f(fn), mag(fn));
grid on;
axis tight;
原文:http://www.cnblogs.com/zhang-pengcheng/p/4489355.html