How to convert this mesh as 3d matrix?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
shubham kumar gupta
el 22 de Nov. de 2022
Respondida: Cris LaPierre
el 22 de Nov. de 2022
AIM : I want to get a 3d plane for this plane as PLANE3D(i,j,k)
I tried creating a meshgrid of xy then added z data
[x y] = meshgrid(0:0.01:4); % Generate x and y data
z = zeros(size(x, 1)); % Generate z data
hs=surf(x, y, z); % Plot the surface
%or
hs=mesh(x,y,z)
Now hs will be having XData, YData, & ZData
Now I did this to get a 3d Matrix
XYZ=[hs.XData; hs.YData; hs.ZData] % PLANE3d
figure,mesh(XYZ)
0 comentarios
Respuesta aceptada
Cris LaPierre
el 22 de Nov. de 2022
Not exactly sure what the question is, but note that XYZ is not the same as (x,y,z). In XYZ, x and y values are your index number, and Z is the values of the matrix. So in the first 401 rows the values show a steady ramp from 1-401 in x, the next 401 rows show a steady ramp from 1-401 in the y direction, and then the last 401 rows are your original Z values of 0.
If you are trying to capture the data in 3D (first sheet is X, 2nd sheet is Y, 3rd sheet is Z), you either need to explicitly assign the data sheet by sheet
XYZ(:,:,1) = x;
XYZ(:,:,2) = y;
XYZ(:,:,3) = z;
or you need to use reshape.
XYZ=[hs.XData; hs.YData; hs.ZData] % PLANE3d
XYZ = reshape(XYZ,length(x),length(y),[])
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots 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!