필터 지우기
필터 지우기

I want to spatially sample the variable M over a certain range of xyz coordinates, but I am unsure how to? Please assist or guide.

조회 수: 2 (최근 30일)
I have a dataset containing the x,y,z points as seperate entries (each a size of 100043) and M (also 100043) as a seperate entry in the workspace. I want to sample the values for M spatially for a grid size that is probably 20x20x20 (in terms of the xyz points) or smaller or bigger. When I get the values for M, then I will perform a calculation and will store all the results as an output vector?
I was looking into Isosurfaces but I'm not sure how to get started? (please scroll to the right side of the data to have a look at how the data is loaded into matlab)data pic matlab.jpg

답변 (1개)

Walter Roberson
Walter Roberson 2019년 11월 3일
F = griddedInterpolant(x, y, z, M);
Xv = linspace(min(x), max(x), 20);
Yv = linspace(min(y), max(y), 20);
Zv = linspace(min(z), max(z), 20);
[Xg,Yg, Zg] = ndgrid(Xv, Yv, Zv);
Mg = F(Xg, Yg, Zg);
Be careful when you use it, though, as the first dimension of Mg will correspond to Y and the second dimension will correspond to X (and the third will correspond to Z)
  댓글 수: 3
Thashen  Naidoo
Thashen Naidoo 2019년 11월 3일
I used scatteredInterpolant and it seems to have worked fine.
However, what is Mg outputting?
Is it giving the M value at every xyz point on the grid? Each M has an xyz coordinate and I want to sample that at various points.
Walter Roberson
Walter Roberson 2019년 11월 3일
Yes, Mg is the M value at every sampled x y z point in the grid. Mg(J,K,L) is M sampled at Yv(J), Xv(K), Zv(L)

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

카테고리

Help CenterFile Exchange에서 Scalar Volume Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by