MATLAB: How to fit a custom probability distribution to the data

probabilityrandom number generatorstatistics

I have a set of data characterised by a high frequency (60-70%) of zero values. I think that the best probability density function to fit my data is something like f(x)=a*exp(-b*x), a two-parameters negative exponential which is not implemented in the software. What I need to do is to fit this equation to my data and generate random numbers inside that distribution. How can I do that?

Best Answer

Since the integral from 0 to Inf must be equal to 1, it follows that a = b = lambda. This is the usual exponential distribution which can be chosen for fitting:
https://de.mathworks.com/help/stats/mle.html
Best wishes
Torsten.