function drawDigit(a,b,W,M)
% Draws the digit encoded in the 7-by-5 array M
% The digit is centered in a black rectangle that has width W
% and height (9/7)W.
% The lower left corner of the rectangle is at (a,b).

hold on
axis equal off

drawRect(a,b,W,(9/7)*W,'k')

% Dot diameter...
h = W/7;

% Draw the dots...

baseX = a+h/2;
baseY = b+8.5*h;
for i=1:7
for j=1:5
if M(i,j)==1
drawDisk(baseX+j*h,baseY-i*h,h/2,'y')
end
end
end