How to generate a linear congruential generator in Matlab and plot the histogram and the CDF?

Viewed 9

enter image description here

  1. I have generated the array x[n] using a for loop in Matlab. It gives me values of the order of 10^10. But I am not able to understand how can I generate uniformly distributed numbers in the interval [a,b] as a uniform distribution will contain values between 1/(b-a).

  2. What does u[n] signify? Is it a unit step function?

This is the code that I have written. How to further solve the problem?

T = 10
x=[]
a=7^5
c=0
m=2^31-1
x(1)=100
for i = 2:T
    % r = rand(N,1)
     x(i) = mod(((x(i - 1) * a) + c ),m)
    % Do something with r
end
0 Answers
Related