Sunday, August 2, 2015

Checkerboard using matlab

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

No comments:

Post a Comment

DC motor control with Pulse Width Modulation Part 1

DC Motor intro DC motor is a device which converts electrical energy into kinetic energy. It converts the DC power into movement. The typica...