matlab 分析wav波形

[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;

posted @ 2015-05-09 09:03  aprial  阅读(1613)  评论(0编辑  收藏  举报