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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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)
0 commentaires
Réponses (1)
Walter Roberson
le 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 commentaires
Walter Roberson
le 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)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!