필터 지우기
필터 지우기

slice in 3D

조회 수: 11 (최근 30일)
Shamsuddeen Abdullahi
Shamsuddeen Abdullahi 2017년 8월 6일
댓글: Walter Roberson 2017년 8월 6일
Hi!
I want to cut a slice at z=-8.266 (Z is a dependent variable that depends on two independent variables x and y). I typed the equation relating z,x and y. mesh(y,x,z) worked perfectly but when ever I try to have a slice using:
slice(z,[0:90:360],[100:225:1000],-8.266)
I always get an error message
'V must be a 3-D array'
Some one should pls help.
my code:
x=0:90:360;
y=100:225:1000
z= .......... (an m by n array)
mesh(y,x,z) (works perfeclty)
slice(z,[0:90:360],[100:225:1000],-8.266) (returns V must be a 3-D array).
I want to read all values of x and y at z=-8.266

채택된 답변

Walter Roberson
Walter Roberson 2017년 8월 6일
In order to use slice, you need three spatial coordinates (x, y, z) and a 3D value array that associates a value with each x, y, z triple.
For your purpose you should probably be using contour3()
contour3(x, y, z, [-8.266, -8.266])
Even if you did have a 3D value array, I suspect you would be wanting isosurface()
  댓글 수: 2
Shamsuddeen Abdullahi
Shamsuddeen Abdullahi 2017년 8월 6일
I want to read all values of x and y at z=-8.266
Walter Roberson
Walter Roberson 2017년 8월 6일
Chances are high that there are no matrix locations as which z = -8.2660000000000000142108547152020037174224853515625 exactly (the closest double precision value to -8.266 that is representable.) Much more likely is that you have locations at which the value is higher than that on one side and lower on another side.
If you then ask "What are the theoretical coordinates which would give z = -8.2660000000000000142108547152020037174224853515625 ?" then you are probably going to end up with an infinite number of coordinates.
Now, if you use
BW = z >= -8.266;
r = ~BW & imfilter(BW,[1 1 1;1 0 1;1 1 1]);
then r should be true for the pixels that are less than -8.266(etc) but for which there is an adjacent pixel that is greater than that value. Each of those pixels could give rise to at least one (x,y) pair at which one could interpolate the value would be -8.266(etc), if you do a plain linear interpolation between the two positions with the assumption that none of the surrounding pixels influences the result. In this simple model, up to 1/4 of the pixels could give rise to 8 interpolated positions each, or up to 1/2 of the pixels could give rise to 4 interpolated positions each.
I will try to refine my model for 2D linear interpolation, but in the meantime you should be thinking about what results you are after.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by