function [output] = background(size,period,MAX,MIN)

output = zeros(size,size);
for i=1:size

     if ( round(i/period) == floor(i/period) )
         output(i,:) = output(i,:)+MIN*ones(1,size)/2;
     else 
         output(i,:) = output(i,:)+MAX*ones(1,size)/2;
     end
end

for j=1:size

     if ( round(j/period) == floor(j/period) )
         output(:,j) = output(:,j)+MIN*ones(size,1)/2;
     else
         output(:,j) = output(:,j)+MAX*ones(size,1)/2;
     end
end

