Plotting a 3D matrix with plot3

8 ビュー (過去 30 日間)
Amit Chakraborty
Amit Chakraborty 2022 年 9 月 21 日
コメント済み: Bjorn Gustavsson 2022 年 9 月 22 日
I have 3 Matrices .
P = rand (2,2,3) ; % row=2, col =2, slice (z axis) =3
Q = rand (1,2);
R = rand (1,2);
I want to plot the Matrix P with corresonponding to Q and R matrix in such a way that :
In 3 dimensional plot => X axis : Q Matrix ; Y axis : R Matrix ; Z axis =P Matrix.
Thank you for your kind help !
  6 件のコメント
Amit Chakraborty
Amit Chakraborty 2022 年 9 月 22 日
編集済み: Amit Chakraborty 2022 年 9 月 22 日
So, I am giving the original matrix size of all the three vectors.
LambdaL = linspace(0.000001,0.0001,20); % [Matrix in X axis]
LambdaT = linspace(0.000001,0.0001,20); % [Matrix in Y axis]
slices = [1 2 3 4 5]; % [Matrix in Z axis]
The Final Resultant matrix P : rand(20,20,5)
Consider that Using LambdaL and LamdaT the matrix P is generated.
My plot should be like that :
1) in X-axis: LambdaL value should be there
2) in Y-axis: LambdaT value should be there
3) in Z axis : The value inside matrix P should be plotted.
So in short, for Slice no. 1 there will be 20x20 value , Same for Slice no. 2- Slice no. 5
Sorry, if I made confusion. Thank you both for your reply.
Walter Roberson
Walter Roberson 2022 年 9 月 22 日
See slice

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

回答 (1 件)

KSSV
KSSV 2022 年 9 月 22 日
LambdaL = linspace(0.000001,0.0001,20); % [Matrix in X axis]
LambdaT = linspace(0.000001,0.0001,20); % [Matrix in Y axis]
z = [1 2 3 4 5]; % [Matrix in Z axis]
[LL,LT,Z] = meshgrid(LambdaL,LambdaT,z) ;
P = rand(20,20,5) ;
% plot plane at x = .000001
slice(LL,LT,Z,P,LambdaL(1),[],[])
% plot plane at x = .000001 and y = 0.0001
slice(LL,LT,Z,P,LambdaL(1),LambdaT(end),[])
% plot all planes along x
slice(LL,LT,Z,P,LambdaL,[],[])
  1 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2022 年 9 月 22 日
Sometimes I have had success with manipulating the "alpha" properties of the surfaces slice generates:
phSl = slice(LL,LT,Z,P,LambdaL,[],[]);
set(phSl,'FaceAlpha',0.7)
shading flat
If that type of visualization is what you're after matlab is a bit lacking, and the best software I've encountered is vis5d - which is an open software project that does this type of volume renderings, primarily for weather-data.

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

カテゴリ

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