MATLAB Answers


How to make a certain pattern on a 2-D grid

Asked by Aaron
on 13 Sep 2013

I'm trying to code a black and white figure that is four quarter circles in a square grid. This is the image of what I want: It will have a for statement and probably and if statement. The code below is not even close to what I want but illustrates the general setup.

    m = 51;
    n = 51;
    maxX = m;
    maxY = n;
    A = zeros(maxX, maxY);
    for i = (1:maxX)
      A(i:51,i:51) = 1;
      if A(i:51,i:51) == 1;
        A(26,i:51) = 0;
        A(i:51,26) = 0;
    set(gca, 'YDir', 'normal');
    axis equal;
    axis tight;



No products are associated with this question.

0 Answers

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!