random generation of fractions

5 vues (au cours des 30 derniers jours)
Anwesha
Anwesha le 13 Août 2018
Commenté : Anwesha le 14 Août 2018
Hello, I have fractions such as 1/720,1/360,1/90. How do i randomise them? these numbers are the spatial frequencies which are in cycles/pixel(by default in psychtoolbox). I would like to have a grating with many spatial frequencies generated randomly. Appreciate any help. Thanks Anwesha

Réponses (1)

KSSV
KSSV le 13 Août 2018
a = 90;
b = 720;
r = (b-a).*rand(100,1) + a;
F = 1./r
  11 commentaires
Anwesha
Anwesha le 14 Août 2018
msize = numel(Fr); for a = 1:msize freq1= Fr(randperm(msize,1));
Screen('DrawTextu re', window, gratingtex, [], [], angle, [], [], [], [], rotateMode, [phase, freq1, amplitude, 0]);
Screen('FillRect', window, [1,1,1],spotRect);
vbl = Screen('Flip', window, vbl + 0.5 * ifi);
end
Anwesha
Anwesha le 14 Août 2018
This is the part of the code where I made the changes..not able to figure out what is going wrong

Connectez-vous pour commenter.

Catégories

En savoir plus sur Timing and presenting 2D and 3D stimuli dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by