1% [x, y] = PdfFromTrace(trace, intBounds)
3% Returns the empirical density function of a trace.
7% trace : vector of doubles
9% intBounds : vector of doubles
10% The array of interval boundaries. The pdf
is the
11% number of samples falling into an interval divided
12% by the interval length.
16% x : vector of doubles
17% The center of the intervals (the points where the
18% empirical pdf
is calculated)
19% y : vector of doubles
20% The values of the empirical pdf at the given points
22function [x, y] = PdfFromTrace (trace, intBounds)
24 intBounds = reshape(intBounds,length(intBounds),1);
25 hist = histc (trace, intBounds);
26 intlens = intBounds(2:end) - intBounds(1:end-1);
27 y = hist(1:end-1) ./ intlens / length(trace);
28 x = (intBounds(2:end) + intBounds(1:end-1)) / 2.0;
29 y = reshape(y, 1, length(y));
30 x = reshape(x, 1, length(x));