1% re = EmpiricalRelativeEntropy(f1, f2, intBounds)
3% Returns the relative entropy (aka Kullback–Leibler
4% divergence) of two continuous functions given by samples
5% and the bounds of the corresponding intervalls.
7% This function can be used to characterize the distance
8% between two density functions, distribution functions,
13% f1 : vector, length M
14% Samples of the first continuous function
15% f2 : vector, length M
16% Samples of the second continuous function
17% intBounds : vector, length M+1
18% The bounds of the intervals. The ith sample
19% corresponds to the interval
20% (intbounds(i),intbounds(i+1))
27function re = EmpiricalRelativeEntropy (f1, f2, intBounds)
29 intlens = intBounds(2:end) - intBounds(1:end-1);
30 intlens = reshape(intlens, size(f1));
33 re = RelativeEntropy (p1, p2);