フィルターのクリア

Problem with non-cubic data plotting using slice.

5 ビュー (過去 30 日間)
Robert Malkin
Robert Malkin 2020 年 4 月 17 日
コメント済み: Ameer Hamza 2020 年 4 月 17 日
Hello,
I'm trying to use SLICE to plot some 3D volumetric data. When I create data that is say, 5x5x5 in size SLICE works fine.
If the data however is 5*3*4 then I can't get it to work. I tried playing with both MESHGRID and NDGRID but I can't get it to tango.
Any suggestions would be very, very welcome. If it's a really easy notation error please go easy on me, kind of new here!
Rob
x = [-2,-1,0,1,2];
y = [-1,0,1];
z = [0,1,2,3];
data = rand(5,3,4);
[mesh_x, mesh_y, mesh_z] = meshgrid(x, y, z);
slice(mesh_x, mesh_y, mesh_z, data , 0, 0, 1); shading interp;

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 17 日
編集済み: Ameer Hamza 2020 年 4 月 17 日
See the order of dimensions in rand()
x = [-2,-1,0,1,2];
y = [-1,0,1];
z = [0,1,2,3];
data = rand(3,5,4);
[mesh_x, mesh_y, mesh_z] = meshgrid(x, y, z);
slice(mesh_x, mesh_y, mesh_z, data , 0, 0, 1); shading interp;
The first axis of a matrix is along rows, i.e., parallel to the y-axis. The second axis of a matrix is along the column, i.e., x-axis, and the third is perpendicular to the plane, i.e., z-axis.
  2 件のコメント
Robert Malkin
Robert Malkin 2020 年 4 月 17 日
Thank you Ameer
Ameer Hamza
Ameer Hamza 2020 年 4 月 17 日
Glad to be of help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by