Filter löschen
Filter löschen

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 Ansichten (letzte 30 Tage)
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

Antworten (1)

Walter Roberson
Walter Roberson am 3 Nov. 2019
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 Kommentare
Thashen  Naidoo
Thashen Naidoo am 3 Nov. 2019
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 am 3 Nov. 2019
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)

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by