random generation of fractions

5 ビュー (過去 30 日間)
Anwesha
Anwesha 2018 年 8 月 13 日
コメント済み: Anwesha 2018 年 8 月 14 日
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

回答 (1 件)

KSSV
KSSV 2018 年 8 月 13 日
a = 90;
b = 720;
r = (b-a).*rand(100,1) + a;
F = 1./r
  11 件のコメント
Anwesha
Anwesha 2018 年 8 月 14 日
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 2018 年 8 月 14 日
This is the part of the code where I made the changes..not able to figure out what is going wrong

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

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by