Hello,
I have modified the 'DotDemo.m' code to display dots that move in a rotational pattern in the field. However, I am having trouble making sure that these rotating dots are moving at the speed I specify, since the 'dot_speed' in the demo is slightly different than the speed required for rotating dots. Could anyone advise me on my error? I am using a change in radians to specify the rotation as shown in the code excerpt below (particularly the final line).
Thanks,
Zahra
% ------------------------
% set dot field parameters
% ------------------------
nframes = 1000; % number of animation frames in loop
mon_width = 39; % horizontal dimension of viewable screen (cm)
v_dist = 80; % viewing distance (cm)
dot_speed = 8; % dot speed (deg/sec)
rot_spd = 2; %(deg/sec)
ndots = 100; % number of dots
max_d = 9; % maximum radius of annulus (degrees)
min_d = 0.5; % minumum
dot_w = 0.1; % width of dot (deg)
fix_r = 0.15; % radius of fixation point (deg)
f_kill = 0.05; % fraction of dots to kill each frame (limited lifetime)
differentcolors =0; % Use a different color for each point if == 1. Use common color white if == 0.
differentsizes = 0; % Use different sizes for each point if >= 1. Use one common size if == 0.
waitframes = 1; % Show new dot-images at each waitframes'th monitor refresh.
% ---------------------------------------
% initialize dot positions and velocities
% ---------------------------------------
ppd = pi * (rect(3)-rect(1)) / atan(mon_width/v_dist/2) / 360; % pixels per degree
pfs = dot_speed * ppd / fps; % dot speed (pixels/frame)
s = dot_w * ppd; % dot size (pixels)
fix_cord = [center-fix_r*ppd center+fix_r*ppd];
rmax = max_d * ppd; % maximum radius of annulus (pixels from center)
rmin = min_d * ppd; % minimum
r = rmax * sqrt(rand(ndots,1)); % r
r(r<rmin) = rmin;
t = 2*pi*rand(ndots,1); % theta polar coordinate
cs = [cos(t), sin(t)];
xy = [r r] .* cs; % dot positions in Cartesian coordinates (pixels from center)
dt = (ones(ndots,1) * (2*pi/360) * (rot_spd*ppd/fps));
I have modified the 'DotDemo.m' code to display dots that move in a rotational pattern in the field. However, I am having trouble making sure that these rotating dots are moving at the speed I specify, since the 'dot_speed' in the demo is slightly different than the speed required for rotating dots. Could anyone advise me on my error? I am using a change in radians to specify the rotation as shown in the code excerpt below (particularly the final line).
Thanks,
Zahra
% ------------------------
% set dot field parameters
% ------------------------
nframes = 1000; % number of animation frames in loop
mon_width = 39; % horizontal dimension of viewable screen (cm)
v_dist = 80; % viewing distance (cm)
dot_speed = 8; % dot speed (deg/sec)
rot_spd = 2; %(deg/sec)
ndots = 100; % number of dots
max_d = 9; % maximum radius of annulus (degrees)
min_d = 0.5; % minumum
dot_w = 0.1; % width of dot (deg)
fix_r = 0.15; % radius of fixation point (deg)
f_kill = 0.05; % fraction of dots to kill each frame (limited lifetime)
differentcolors =0; % Use a different color for each point if == 1. Use common color white if == 0.
differentsizes = 0; % Use different sizes for each point if >= 1. Use one common size if == 0.
waitframes = 1; % Show new dot-images at each waitframes'th monitor refresh.
% ---------------------------------------
% initialize dot positions and velocities
% ---------------------------------------
ppd = pi * (rect(3)-rect(1)) / atan(mon_width/v_dist/2) / 360; % pixels per degree
pfs = dot_speed * ppd / fps; % dot speed (pixels/frame)
s = dot_w * ppd; % dot size (pixels)
fix_cord = [center-fix_r*ppd center+fix_r*ppd];
rmax = max_d * ppd; % maximum radius of annulus (pixels from center)
rmin = min_d * ppd; % minimum
r = rmax * sqrt(rand(ndots,1)); % r
r(r<rmin) = rmin;
t = 2*pi*rand(ndots,1); % theta polar coordinate
cs = [cos(t), sin(t)];
xy = [r r] .* cs; % dot positions in Cartesian coordinates (pixels from center)
dt = (ones(ndots,1) * (2*pi/360) * (rot_spd*ppd/fps));