Suppose that we have a probability density function (PDF) that is impossible to analyze analytically. How can we ever draw samples from this PDF? Luckily, there are many techniques out there and this time I will highlight rejection sampling. A simple to implement (but not always effective) sampling method.
By the way, you should definitely read this article on curve fitting in MATLAB.