%spectralflatness.m
function [res]=spectralflatness(x,n)
res=lpc(x,n)';
e=abs(fft(res,1024)).*abs(fft(x,1024))';
e1=log(sum(e.^2)/1024);
s=(abs(fft(x,1024)).^2);
s1=sum(log(s))/1024;
res=e1-s1;