pseudo random numbers using the linear congruent method

how can i plot scatter plot between x(i) and x(i-1)
like:
x(i) = (mod(a*x(i-1)+c,m))
where "a" and "c" are contant and "m" is mod

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 4일
Try this
a = 37;
c = 91;
m = 10000;
x = zeros(1,10000);
x(1) = 7;
for i=2:numel(x)
x(i) = mod(a*x(i-1)+c,m);
end
X = x(1:end-1);
Y = x(2:end);
scatter(X,Y, '.');

추가 답변 (1개)

Rahul kumar
Rahul kumar 2022년 10월 27일

0 개 추천

a = 37;
c = 91;
m = 10000;
x = zeros(1,10000);
x(1) = 7;
for i=2:numel(x)
x(i) = mod(a*x(i-1)+c,m);
end
X = x(1:end-1);
Y = x(2:end);
scatter(X,Y, '.');

카테고리

도움말 센터File Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

태그

질문:

2020년 4월 4일

답변:

2022년 10월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by