I have to create a random variable X distributed uniformly over [2,5] and generate more than 10000 samples.
Then I have to estimate the probability density function of X using histc()
or hist()
functions, and plot estimated PDF with theoretic curve.
I have no idea how to solve it with MATLAB.
Generate the Uniform random variable using
rand()
for the [0,1] interval. Then shift it witha
and scale (stretch) it withb-a
.Then plot the sample distribution & the theoretical distribution (Wiki).