function [h]=newhist(AI,d,b)
  %h=num F0*num AU*b
  %AI=12x23xn events
  %d=log bin width
  %b=number bins
    
nn=size(AI);
hb=[[1:b]*d+2.5-d*b 5];            % bins[-1.28 -.02 1.24 2.50 5]

for j=1:nn(1)                      %number of filters
   r=2^(j/2);                      %frequency norm constant 
   for k=1:nn(2)                   %number of CERT channels
     x=AI(j,k,:);x=x(x>0);x=log(x(:));  %x=log(AI+)
     for i=1:b                      
       h(j,k,i)=size(find(x>hb(i)&x<=hb(i+1)),1)*r;%normed count 
     end
   end
end

h=h(:)';
h=h/sqrt(h*h'); %normalized h
