Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I have to write a Pseudo random number generator with matlab, but I don't know how to start.
This is the equation:
Xk+1 = [711*Xk + 37]mod10000 and xo = 1234
I know that I need to write a loop statement, but I don't know how to do it. Also, what is "mod" and is there a statement in matlab to find the it?
This is what I've done, but it doesn't work
m = 1000;
a = 711;
b = 37;
x(0) = 1234;
for k = 0:100
x(k+1) = mod(a*x(k) + b,m);
Thanks in advance
0 · ·