Divide an area into equal sized small grids

10 ビュー (過去 30 日間)
joy
joy 2015 年 3 月 8 日
コメント済み: Swati Sarangi 2020 年 10 月 29 日
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 日
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 件のコメント
Star Strider
Star Strider 2015 年 3 月 8 日
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?

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 3 月 8 日

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by