フィルターのクリア

how to plot a 3-dimensional matrix

101 ビュー (過去 30 日間)
RUTWIK GHIYA
RUTWIK GHIYA 2014 年 9 月 16 日
コメント済み: Tien Thang Dinh 2019 年 7 月 16 日
Let say i have a 3-d matrix rand(3,3,3);
I want to see this 27 values in a box (a plot where we define all the three z-axis) from x=1:3; y=1:3, z=1:3;
can anybody help?

回答 (3 件)

José-Luis
José-Luis 2014 年 9 月 16 日
  1 件のコメント
Tien Thang Dinh
Tien Thang Dinh 2019 年 7 月 16 日
das gefällt mir, kurz und knackig

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


Adam Cutbill
Adam Cutbill 2014 年 9 月 16 日
編集済み: Adam Cutbill 2014 年 9 月 16 日
X=rand(3,9,3); %(3 coords, 9 points, 3 groups)=27 points.
X=reshape(X,[],3);
plot3(X(:,1),X(:,2),X(:,3),'.');
In general, I'd avoid a 3D matrix. What you're really doing with a 2D matrix is accessing the point and the coordinate (2 indices, i=point,j=coordinate). You can have as many dimensions in the coordinates as you want. If you want to go 3D, then you're accessing the group, the point and the coordinate (i,j,k). Make sure this is what you want if you're using 3D matrices.
Not sure what you mean about a box but I don't think rand(3,3,3) is what you are after.
  1 件のコメント
Huy Kien Bui
Huy Kien Bui 2019 年 4 月 1 日
Thank you so much, Adam Cutbill.
It's work in my case.
A little bit change in code:
%% B: 3D matrix 1x258x8
X=reshape(B,[],8); %% X: 2D matrix 258x8
[xx yy] = meshgrid(1:8,1:258);
plot3(xx,yy,X,'*');
Capture.JPG

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


RUTWIK GHIYA
RUTWIK GHIYA 2014 年 9 月 16 日
Thanks john for the quick response.
But i think in plot3, we define only x and y axis and the points we plot are the in accordance with z-axis.
Here I want to plot the three axis....and then plot the 27 points obtained by rand(3,3,3);
in order from (1,1,1) to (3,3,3)...can u help me with that?

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by