How can I make a set of stimuli composed of pseudorandom dots of the same size and each stimuli having different spatial frequencies/densities?

1 vue (au cours des 30 derniers jours)
I'd like to generate 50 stimuli composed of pseudorandom dots of the same size and each stimulus having different spatial frequencies/densities? I think I need to use stochastic screening based on my google searches but I don't know how to generate them. The picture attached is from wikipedia. I'd like to generate something similiar to the smaller squares where we can see how each is increasing in sptial frequency.
Thank you for your help!
Refernce: https://en.wikipedia.org/wiki/Stochastic_screening

Réponses (1)

chicken vector
chicken vector le 19 Avr 2023
Modifié(e) : chicken vector le 19 Avr 2023
This is slow and inefficient and can be improven with more pseudo-random techniques, but it does the tricks:
% Dots size:
dotSize = 5;
% Numbers density variations along 'x':
xSize = 1e3;
% Number of dots at first and last x:
minDots = 1;
maxDots = 1000;
% Dots interpolation:
nDots = linspace(minDots, maxDots, xSize);
% Initiliase figure:
figure;
hold on;
% loop over x coordinates:
for x = 1 : xSize
% Number of dots at current 'x':
numEl = round(nDots(x));
% Create 'x' noise:
noise = rand(numEl, 1) - .5;
% Plot dots at current 'x':
scatter(x + noise, rand(1,numEl), dotSize, 'k', 'Filled');
end
% Figure properties:
xlim([0, xSize])
ylim([0, 1])
set(gca, 'Color', 'w', 'XColor', 'None', 'YColor', 'None')
Result:

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by