I have the following assignment:
It requires to generate samples from $u(7,10)$,the uniform distribution on the interval $2 \leq x \leq 11$. Compare the normalized histogram with the density function(pdf).
I have no idea. I need help please, thanks.
I have the following assignment:
It requires to generate samples from $u(7,10)$,the uniform distribution on the interval $2 \leq x \leq 11$. Compare the normalized histogram with the density function(pdf).
I have no idea. I need help please, thanks.
I don't see why the uniform distribution on $[2,11]$ is denoted by $u(7,10)$, but anyway, the steps are:
rand(1000,1) creates a column vector of size $1000$ with this distribution.The result should look like this:

I used Scilab instead of Matlab; the syntax is identical in the computational part and slightly different in the graphic output part.
x = (11-2)*rand(1000,1)+2*ones(1000,1)
histplot(30,x)
t = 2:0.01:11
f = (1/(11-2))*ones(t)
plot(t,f)