필터 지우기
필터 지우기

meshgrid() confusion (dimesions, index,...)

조회 수: 5 (최근 30일)
carmen
carmen 2012년 2월 15일
편집: Cedric 2013년 10월 15일
Hello everybody, i have a fundamental question on the meshgrid() function. I have a 10x20x30 cubus of scalar data. i wanted to save the x,y- and z coordinates of these points in real space to 3 matrices coordX coordY and coordZ. i tried
[ccordX coordY coordZ]=meshgrid(xmin:xmax, ymin:ymax, zmin:zmax)
and got a horrible mess, since size(coordX) turns out as [20,10,30]. Does anybody know what my mistake is? thanks! carmen

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 2월 17일
can so?
[ccordX coordZ coordY]=meshgrid(xmin:xmax, zmin:zmax, ymin:ymax)
ADD
[ccordZ coordX coordY]=ndgrid(zmin:zmax, xmin:xmax, ymin:ymax)
eg
yourcubus = randi(150,4,5,3)
x = linspace(0,300,s(2))
y = linspace(0,250,s(3))
z = linspace(0,250,s(1))
[ccordZ coordX coordY]=ndgrid(z,x,y)
  댓글 수: 3
Andrei Bobrov
Andrei Bobrov 2012년 2월 17일
Hi Carmen! Added else variant.
carmen
carmen 2012년 2월 17일
as far as i can see the ndgrid is what i was looking for, so that is a valid answer! thanks.
i just found the Grid Representation page and i think i can learn from there whats the idea of haveing these 2 functions.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by