sca;
close all;
clear;
PsychDefaultSetup(2);
screens = Screen('Screens');
screenNumber = max(screens);
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
grey = white / 2;
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, grey);
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
xRadius = windowRect(3) / 2;
yRadius = windowRect(4) / 2;
screenYlim = windowRect(4) * .97;
rcycles = 8;
tcycles = 24;
xylim = 2 * pi * rcycles;
[x, y] = meshgrid(-xylim: 2 * xylim / (screenYlim - 1): xylim,...
-xylim: 2 * xylim / (screenYlim - 1): xylim);
at = atan2(y, x);
checks = ((1 + sign(sin(at * tcycles) + eps)...
.* sign(sin(sqrt(x.^2 + y.^2)))) / 2) * (white - black) + black;
circle = x.^2 + y.^2 <= xylim^2;
checks = circle .* checks + grey * ~circle;
radialCheckerboardTexture = Screen('MakeTexture', window, checks);
Screen('DrawTexture', window, radialCheckerboardTexture);
Screen('Flip', window);
KbStrokeWait;
sca;