how to draw a checkerboard with 9 squares each with 0.5 dimension?

1 view (last 30 days)
I tried it by using the checkerboard command but it only gives us a even number of squares.
  3 Comments
Geoff Hayes
Geoff Hayes on 20 Sep 2016
dinesh - please clarify 0.5 dimension means. I'm guessing it has something to do with the dimension of each square in the checkerboard but you will need to provide more information. Also, is this homework?

Sign in to comment.

Answers (2)

Thorsten
Thorsten on 20 Sep 2016
You cannot create an image with pixels of dimension 0.5. The dimension of a pixel is always 1. Or what do you mean by 'with dimension 0.5'?

Image Analyst
Image Analyst on 20 Sep 2016
You can't have half a matrix element, but you can define the "width" of the element to be 0.5 or whatever you want. Then just use repmat(). First create one dark/light pair on one line. Then use repmat() to make a complete line. Then use repmat again to make a "band". Stitch together a band with a band of the opposite colors to get a band pair, like the top two rows of a chessboard. Then use repmat again to make as many vertical pairs as you want.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!