How to create a box inside box?
Show older comments
I am trying to create a large box (Four division) and further divide individual box into four small boxes. I am able to divide the boxes on bottom left and top right portion but not in top left and bottom right portion, can anyone please help me on this. I have attached the MATLAB code and also the image for reference.
Thank you
The code:
clear
clc
nx=3;
ny=3;
x=linspace(0,1,nx);
y=linspace(0,1,ny);
[X,Y]=meshgrid(x,y);
%%%%%%%%%%%%%%%%%%%
x1=linspace(0,1/2,nx);
y1=linspace(0,1/2,ny);
[X1,Y1]=meshgrid(x1,y1);
%%%%%%%%%%%%%%%%%%%
x2=linspace(0,1/4,nx);
y2=linspace(0,1/4,ny);
[X2,Y2]=meshgrid(x2,y2);
%%%%%%%%%%%%%%%%%%%
x3=linspace(1/2,1,nx);
y3=linspace(1/2,1,ny);
[X3,Y3]=meshgrid(x3,y3);
plot(X,Y,'k',Y,X,'k');
hold on
plot(X1,Y1,'k',Y1,X1,'k');
hold on
plot(X2,Y2,'k',Y2,X2,'k');
hold on
plot(X3,Y3,'k',Y3,X3,'k');
Accepted Answer
More Answers (0)
Categories
Find more on Sources 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!