How to make a certain pattern on a 2-D grid
6 views (last 30 days)
Show older comments
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: https://docs.google.com/drawings/d/1FDyLv3zASGpJ3GCJ6r8ryEXfCbfaZN5fLGLTqLnKeSE/edit?usp=sharing. 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;
end
end
imagesc(A');
set(gca, 'YDir', 'normal');
colormap(1-gray);
axis equal;
axis tight;
0 Comments
Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!