4d plotting with slices

6 ビュー (過去 30 日間)
Matthew Worker
Matthew Worker 2019 年 10 月 2 日
編集済み: N/A 2021 年 6 月 18 日
Hello :)
I have 4d data (x y z coordinates and and V). I am hoping to represent the data similar to the slice function approach however I do not want the V values to be inerpolated for each square. I want each square to represent one of my data points (so x = 0, y=0, z=0 is a whole square not the inersection of squares as the slice function does). I could also potentially have a graph with circles for each data point or any other suggestions. I just need every data point to be visible.
[X,Y,Z] = meshgrid(0:4, 0:4, 0:3);
V = [0.95, 1.05, 0.87, 0.9, 0.66;
1.25,1.79, 18.1, 1.18, 1.22;
1.95, 6.27, 37.4, 6, 2.13;
3.06, 3.94, 11.4, 2.4, 1.8;
1.1, 1.3, 3.2, 1.8, 0.8];
V(:, :, 2) = [2.9, 2.7, 1.9, 3.1, 2.1;
1.1, 5.7, 18.5, 7.4, 0.6;
3, 10.9, 37.8, 14.5, 4.2;
2.6, 7.4, 9.4, 6.2, 3.8;
3, 2.2, 5.2, 3.8, 3];
V(:, :, 3) = [1.8, 3.2, 3, 3, 2.2;
3, 3, 14.9, 7.4, 1.8;
3.2, 10.7, 11.5, 23.9, 6.6;
2.2, 7.8, 9.8, 8.6, 3.8;
1.6, 1.8, 3.8, 3.8, 3];
V(:, :, 4) = [1.8, 2, 5, 4.4, 3.8;
2.2, 9.4, 8.8, 17.9, 5.8;
3.4, 20, 26.1, 20.1, 6.2;
4.4, 14.3, 6.6, 13.7, 6.6;
3.8, 3, 7.6, 3.4, 2.6];
zslice = [];
xslice = [0,1,2,3,4];
yslice = [];
figure
slice(X, Y, Z, V,xslice,yslice,zslice);
pbaspect([3 1 1])
colorbar
xlabel('X'); ylabel('Y'); zlabel('Z')
  2 件のコメント
darova
darova 2019 年 10 月 2 日
But you only have 4 values for Z direction
11Capture.PNG
N/A
N/A 2019 年 10 月 2 日
yes so i want 4 squares one for each value. I want each square to represent one of my data points not each square intersection

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

採用された回答

darova
darova 2019 年 10 月 2 日
slice() just doesn't use last column and row for displaying colors
So i just copied values
[X,Y,Z] = meshgrid(0:4, 0:5, 0:4); % create bigger mesh
V = [0.95, 1.05, 0.87, 0.9, 0.66;
%%%%%%%
V = cat(1,V,V(end,:,:)); % one more row (last row copy)
V = cat(3,V,V(:,:,end)); % more data for 3d dimension (last matrix copy)
result:
img1.png
  2 件のコメント
N/A
N/A 2019 年 10 月 8 日
thank you! am just wondering how would you do z slices instead ? I tried doing this - but doen't work... If you know, would be greatly appreciated :) x
[X,Y,Z] = meshgrid(0:5, 0:5, 0:3);
...
V = cat(1,V,V(end,:,:));
V = cat(1,V,V(:,end,:));
darova
darova 2019 年 10 月 8 日
What about slice function?

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

その他の回答 (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