title: Kullback Leibler Divergence of 2 Histograms in MatLab
body: <p>I would like a function to calculate the KL distance between two histograms in MatLab. I tried this code:
  <a href="http://www.mathworks.com/matlabcentral/fileexchange/13089-kldiv" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/13089-kldiv</a></p>
  
  <p>However, it says that I should have two distributions P and Q of sizes n x nbins. However, I am having trouble understanding how the author of the package wants me to arrange the histograms. I thought that providing the discretized values of the random variable together with the number of bins would suffice (I would assume the algorithm would use an arbitrary support to evaluate the expectations).</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks.</p>