function [ Q ] = checkerboard( n , m )
Q = ones(n,m);
for c = 1 : m
for r = 1 : n
if mod(r,2) == 0 && ~mod(c,2) == 0
Q (r,c) = 0;
elseif ~mod(r,2) == 0 && mod(c,2) == 0
Q (r,c) = 0;
end
end
end
end
Q = ones(n,m);
for c = 1 : m
for r = 1 : n
if mod(r,2) == 0 && ~mod(c,2) == 0
Q (r,c) = 0;
elseif ~mod(r,2) == 0 && mod(c,2) == 0
Q (r,c) = 0;
end
end
end
end
No comments:
Post a Comment