pseudo random numbers using the linear congruent method

32 ビュー (過去 30 日間)
Kapil Gupta
Kapil Gupta 2020 年 4 月 4 日
回答済み: Rahul kumar 2022 年 10 月 27 日
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 日
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, '.');

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by