**histogram_pdf_2d_sample_test**,
a MATLAB code which
calls histogram_pdf_2d_sample(), which
demonstrates how uniform sampling of a 2D region with respect to some
known Probability Density Function (PDF) can be approximated by
decomposing the region into rectangles, approximating the PDF by
a piecewise constant function, constructing a histogram for the CDF,
and then sampling.

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

histogram_pdf_2d_sample, a MATLAB code which demonstrates how uniform sampling of a 2D region with respect to some known Probability Density Function (PDF) can be approximated by decomposing the region into rectangles, approximating the PDF by a piecewise constant function, constructing a histogram for the CDF, and then sampling.

- histogram_pdf_2d_sample_test.m, calls all the tests.
- histogram_pdf_2d_sample_test.sh, runs all the tests.
- histogram_pdf_2d_sample.txt, the output file.

- chebyshev.txt, 1000 samples from [-1,+1]x[-1,+1] with a product Chebyshev PDF, decomposed into a 20x20 nonuniform grid of rectangles whose widths are also governed by the Chebyshev PDF.
- chebyshev.png
- square_sqrt.txt, 1000 samples from [-1,+1]x[0,+1] with the PDF(x,y)=(1-x^2)*sqrt(y), decomposed into a 20x20 uniform grid of rectangles.
- square_sqrt.png