How can I select three random sample of a matrix with minimum separation between samples?
Show older comments
Hi everyone,
I have the following problem: I have a matrix A(20x20) per example and I need select from this matrix 3 random samples that have to be different and with a minimum separation (distance) between samples. I mean that between samples chosen randomly, would exist a minimum separation of 4 samples, per example the sum of 3 samples to the right in the same row and 1 sample up in the column.
There exists a way to obtain this?
I have been trying to get this using the following, but if I repeat it 3 times, exists the probability to get the same sample. Also I don't know how to get the restriction of the minimum separation.
random_sample1 = A(randi(numel(A)))
Thank you very much in advance for your help.
J.F.
2 Comments
James Tursa
on 8 Feb 2021
Edited: James Tursa
on 8 Feb 2021
You may need to do this either sequentially or with a rejection method to satisfy your distance requirement.
Javier Fuster
on 8 Feb 2021
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!