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)
0 件のコメント
回答 (1 件)
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 件のコメント
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)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!