Create a coordinate system (x, y, z) matrix

24 visualizaciones (últimos 30 días)
Iliqe
Iliqe el 23 de Feb. de 2022
Editada: Iliqe el 24 de Feb. de 2022
The idea is to build a dataset of coordinates matrix with 3 coordinates along X, Y, and Z. The data which I have are:
% min and max coordinates of the dataset
Xmin = 388363.3 Xmax = 390229.2
Ymin = 3310114 Ymax = 3311144
Zmin = 2027.96 Zmax = 2889.9
% sub-block size along x, y, z:
dx = 20; dy = 20; dz = 10;
% number of layers along x, y, z:
nx = 95; ny = 53; nz = 88;
The resulting dataset starts with the min values of coordinates and goes up to max coordnates. The result is a matrix with 3 columns X, Y, and Z and the coordinates below, which correspond to the number of layers and sub-block size. And the result if you imagine will look like a big rectange with many subblocks.
I tried with a nested loop with some logic statements, but it is just produce the wrong coordinates. I think that I coded it incorrectly. If you need more info or details, please ask. Thank you for attention.

Respuesta aceptada

David Hill
David Hill el 23 de Feb. de 2022
Editada: David Hill el 23 de Feb. de 2022
Xmin = 388363.3;
Xmax = 390229.2;
Ymin = 3310114;
Ymax = 3311144;
Zmin = 2027.96;
Zmax = 2889.9;
[X,Y,Z]=meshgrid(linspace(Xmin,Xmax,95),linspace(Ymin,Ymax,53),linspace(Zmin,Zmax,88));
scatter3(X(:),Y(:),Z(:));
  3 comentarios
Iliqe
Iliqe el 24 de Feb. de 2022
Is it possible to build sub-blocks of exact necessary size? Because in the output the size varies, somewhere 19, somewhere 20, etc.
Iliqe
Iliqe el 24 de Feb. de 2022
Editada: Iliqe el 24 de Feb. de 2022
I found out, how to do this)
Just necessary change the code a bit:
[X,Y,Z]=meshgrid(linspace(Xmin,Xmin+dx*nx,nx+1),linspace(Ymin,Ymin+dy*ny,ny+1),linspace(Zmin,Zmin+dz*nz,nz+1));

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation of 2-D Selections in 3-D Grids en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by