Hi,
I am working in WSN. I have created a sensor network of size (100 * 100)..How could i divide that region into equal sized small grids..Can meshgrid be used here? how?

 채택된 답변

Star Strider
Star Strider 2015년 3월 8일

0 개 추천

I’m not certain what you mean by ‘equal size small grids’, but if you want a (100x100) grid, this is one way to do it:
x = linspace(1, 100);
[X,Y] = meshgrid(x);
figure(1)
plot(X,Y,'k')
hold on
plot(Y,X,'k')
hold off

댓글 수: 5

by ‘equal size small grids’, I mean that, I want to fill up that space with squares having same size.
This plot is what the code produces:
Is that what you want?
joy
joy 2015년 3월 8일
I want something this
This code should work:
NrGrid = 6; % Number Of Grids
x = linspace(0, 100, NrGrid+1);
[X,Y] = meshgrid(x);
figure(1)
plot(X,Y,'k')
hold on
plot(Y,X,'k')
hold off
set(gca, 'Box','off', 'XTick',[], 'YTick',[])
axis square
The ‘NrGrid’ assignment is the number of grids created on each axis.
The new plot:
Swati Sarangi
Swati Sarangi 2020년 10월 29일
@Star Strider
How can it be done in case of a 3D figure? like for a cuboid?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

joy
2015년 3월 8일

댓글:

2020년 10월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by