www.pudn.com > spectrogram_analysis.rar > yuputu4.m
%%%%ÓïÆ×ͼ2
%%%%tm=len_x/fs;
%%%%axis([0 tm 0 fs/2]);
clear all;
close all;
clc;
for i=0:11
switch i
case 0
file='0.wav';figure(1);
case 1
file='1.wav';figure(2);
case 2
file='2.wav';figure(3);
case 3
file='3.wav';figure(4);
case 4
file='4.wav';figure(5);
case 5
file='5.wav';figure(6);
case 6
file='6.wav';figure(7);
case 7
file='7.wav';figure(8);
case 8
file='8.wav';figure(9);
case 9
file='9.wav';figure(10);
case 10
file='10.wav';figure(11);
case 11
file='1y.wav';figure(12);
end
[x,fs,p]=wavread(file);
len_x=length(x);
x=filter([1-0.9375],1,x);
len=150;
lenshift=30;
y=enframe(x,len,lenshift); %%
[m,n]=size(y);
for i=1:m
fft_mag=abs(fft(y(i,:),n));
yupu(i,:)=fft_mag.^2;
end
s=max(yupu);
ss=max(s);
yupu2=yupu/ss;
yupu3=yupu2(:,1:len/2);
imshow(yupu3',[0 1]);
title(file);
xlabel('t/s');
ylabel('f/Hz');
end