function m = mfcc(num,s,Fs)

n=512;            
Tf=0.5;         
N=Fs*Tf;            
fn=24;             
l=length(s);      
Ts=0.25;           
FrameStep=floor(Fs*Ts);
a=1;
b=[1, -0.97];   

noFrames=floor(l/FrameStep);    
M=zeros(noFrames-2, num);
lifter=1:num;                  
lifter=1+floor((num)/2)*(sin(lifter*pi/num));

if mean(abs(s)) > 0.01
    s=s/max(s);                     
end

for i=1:noFrames-2
    frame=s((i-1)*FrameStep+1:(i-1)*FrameStep+N);  
    Ce1=sum(frame.^2);       
    Ce2=max(Ce1,2e-22);         
    Ce=log(Ce2);
    framef=filter(b,a,frame);   
    Fi=framef.*hamming(N);       
    FFTo=fft(Fi,N);             
    melf=melbankm(fn,n,Fs);    
    halfn=1+floor(n/2);    
    spectr1=log10(melf*abs(FFTo(1:halfn)).^2);
    spectr=max(spectr1(:),1e-22);
    c=dct(spectr);              
    c(1)=Ce;                 
    coeffs=c(1:num);           
    ncoeffs=coeffs.*lifter';   
    M(i, :)=ncoeffs';     
end
m = mean(M);
