 clear all;
 close all;

 data={bat, ballu, tab, catch, suthaharan, catch, patch, \ldots
     dad, god, dog, accommodation, accommodation, performance, \ldots
     degradation, methods, telephone, computer, science,machine, \ldots
     learning, am, to, shanmugathasan,machine,machine
 };
%ballu and patch collide

 NN=size(data,2);
%number of features
 LL=16;
%predefined number of bins
 MM=8;
%predefined size for the bins (bin cells)
 randn(seed,129);
 tt=10+floor(131*randn(1,LL));

 bin=zeros(1,LL*MM);
%size for 2D vector

 for ii=1:NN
   xx{ii}=(data{ii}+data{ii})/2;
   sz{ii}=length(data{ii});
   %length of the word in process
   ww{ii}=tt(1:size(xx{ii},2));
   hh{ii}=sum(ww{ii}.*xx{ii});

   ind{ii}=(sz{ii}-1)*MM + mod(hh{ii},MM);
   %indexing of vector
   bin(1+ind{ii})=bin(1+ind{ii}) + 1;
   %updating at each index
 end

 LL=find(bin>0);

 figure;plot(bin,.);grid on;axis([min(LL)-100 max(LL)+100 0 3]);
 xlabel(Feature Index);ylabel(Number of Features);

 figure
 au=find(bin>0);
 ax=au;
 ay=bin(au);
 plot(ax,ay,.);grid on;
 for ii=1:size(au,2)
   line([ax(ii) ax(ii)],[0 ay(ii)]);
 end
 set(gca,YLim,[0 max(ay)]);

 gg=[data; sz; ind];
 jj=0;ii=1;
 while(jj<size(data,2))
   fprintf(%17s \t %4d \t %4d \n,gg{ii},gg{ii+1},gg{ii+2})
   jj=jj+1;
   ii=3*jj+1;
 end

 sortrows(gg,2)