MATLAB: Please please help,

duplicate post requiring merginghomeworkprobability

The question is toWrite a MATLAB script to do the following a. Create 10000 random variables uniformly distributed between 2 and 4. b. Create a histogram to approximate the actual probability density function. c. Superimpose the actual probability density function to the above histogram
This is what I have gotten so far
a=2; b=4; n=10000; r = a + (b-a).*rand(n,1);
xlabel('index');ylabel('Amplitude');grid pause X=1:10 y = unifpdf(X,2,4); hist(r,10) got stocked
Thank you so much

Best Answer

Please do not open duplicate questions: it just results in duplicate effort.