How i can generate 2D matrix with unique values using 2D choatic map ?

1 回表示 (過去 30 日間)
Radhwan Jawad
Radhwan Jawad 2023 年 3 月 14 日
回答済み: Image Analyst 2023 年 3 月 14 日
Hellow matlab comunity.
I want to generate (20*20) matrix with unique values for each row and each column and the range of values in each cell must be between 0 and 19 using 2D chaotic map and with matalb code.
for example, if the size of matrix is 4*4 the output must be as below:
0 3 2 1
1 2 0 3
3 0 1 2
2 1 3 0
and i want this output is fixed for each run.
  3 件のコメント
Radhwan Jawad
Radhwan Jawad 2023 年 3 月 14 日
2D chaotic map generate random numbers and it is sensetive to intial parameters
Dyuman Joshi
Dyuman Joshi 2023 年 3 月 14 日
How does it generate random numbers?
You still didn't answer - What is the logic behind this output? and is the output I mentioned acceptable or not?

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2023 年 3 月 14 日
Try this:
numbers = repmat(randperm(20)-1, 1, 20);
randomIndexes = randperm(numel(numbers));
finalMatrix = reshape(numbers(randomIndexes), 20, 20)
unless you mean a Latin Square

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by