function [nDictionary] =FitLSF2Dictionary(KernelFunction,DicSize,DicShift)
%----------------------------------------------
%  This function fits the samling kernels to all shifted versions of a dictionary 
%
%-----------------------------------------------

DicRows=DicSize/DicShift;


tempDict=zeros(1,DicSize);
nDictionary=zeros(DicRows,DicSize);
KSize=size(KernelFunction,2);


for row=1:DicRows
  
    if ((DicSize-row)>KSize)  %--- if fully filled 
    tempDict(1:row)=0; 
    tempDict(row:row+KSize-1)=KernelFunction(1:KSize);
    
     elseif (DicSize-row+1 < KSize) %--- if partially filled 
         LastPost=DicSize-row+1;
        tempDict(row:DicSize)=KernelFunction(1:LastPost);
      
end
    
  nDictionary(row,:)=tempDict(1:DicSize)/norm(tempDict(1:DicSize));
        
end


end