www.pudn.com > mel_endpointdetection.rar > melfilterbank.m


function y=melfilterbank(pp,n,fs) 
%Inputs:	pp   number of filters in filterbank 
%		n   length of fft 
%		fs  sample rate in Hz 
 
if nargin < 3 
    error('you should exame your nargin'); 
end 
 
H=fs*0.5; 
mel_max=2595*log10(1+H/700); 
mel_max=round(mel_max); 
mel_scale=linspace(0,mel_max,pp+2); 
mel_scale=round(mel_scale); 
q=700*(10.^(mel_scale./2595)-1); 
q=round(q); 
le=q(1:20); 
cf=q(2:21); 
re=q(3:22); 
k=1:round(n/2); 
f=k./n*fs; 
j=1; 
for i=1:round(n/2) 
    if f(i)cf(j) 
            y(j,i)=(f(i)-re(j))/(cf(j)-re(j)); 
        end 
    elseif j<20 
        if f(i)cf(j) 
            y(j,i)=(f(i)-re(j))/(cf(j)-re(j)); 
        end 
        end 
    else 
        if f(i)cf(j) 
            y(j,i)=(f(i)-re(j))/(cf(j)-re(j)); 
        end 
        
    end 
end