How to plot 3-D grid data in scatter plot?

Hello Community,
I have 2 datasets from a 3-D simulation model. I can easily read these datasets into Matlab and see the data. I now want to plot these 2 datasets on a scatter plot. I am struggling to get this data plotted.
I load the grid with:
>> A=load('PERM2.mat')
A =
struct with fields:
Node: [1×1 struct]
Same for 2nd dataset.
When I do:
>> plot(A.Node.Value,B.Node.Value)
Error using plot
Data cannot have more than 2 dimensions.
And this is where I am stuck. Any suggestion what I am doing wrong or what I need to do to plot these 2 datasets? I have attached the 2 datasets.
Thanks,
Ferry

1 件のコメント

Jorg Herwanger
Jorg Herwanger 2021 年 8 月 17 日
編集済み: Jorg Herwanger 2022 年 1 月 14 日
You can reshape both 3-D arrays into vectors of length nx*ny*nz.
PERM = load('PERM2.mat')
PERM_Vector = reshape(PERM.Node.Value,[51*107*57,1,1])
PHIE = load('PHIE.mat')
PHIE_Vector = reshape(PHIE.Node.Value,[51*107*57,1,1])
plot(PHIE_Vector,PERM_Vector)
In the example, I get the dimensions of the 3D array (51 x 107 x 57) using size(PERM.Node.Value).
I think I know what you want to do: you can now establish a relationship between PHIE and PERM from the crossplot.

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

 採用された回答

KSSV
KSSV 2020 年 10 月 13 日
編集済み: KSSV 2020 年 10 月 13 日

0 投票

I think your mat files has 3D matrices. You need to use cpcolor or surf to plot them.
load PERM2.mat ;
A = Node.Value ;
[m,n,p] = size(A) ;
for i = 1:p
pcolor(A(:,:,i))
shading interp
colorbar
drawnow
end
If you have x, y you can provide them in pcolor.

2 件のコメント

Ferry Nieuwland
Ferry Nieuwland 2020 年 10 月 13 日
Hello,
You are correct: the mat files have data for 3D matrices.
I wouild like to create a crossplot of these 2 3D matrices, with A on the X-axis and B on the Y-axis. That is where I am struggling; how to create this cross plot. The plot function does not allow 3D matrices to be plotted in a scatter plot.
Any suggestions?
Thanks,
Ferry
KSSV
KSSV 2020 年 10 月 13 日
What do you mean by cross plot? Won't surf/ pcolor work for you?
In case are you looking to plot a slice..have a look on slice function.

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

その他の回答 (1 件)

Ferry Nieuwland
Ferry Nieuwland 2020 年 10 月 13 日

0 投票

Hello,
The A matrix is made up of 51 x 107 x 51 datapoints. The B matrix has same size, 51 x 107 x 51 datapoints. Point A(1,1,1) correlates to point B(1,1,1) , etc.
I want to create a plot where all A points are plotted on X-axis and all corresponding B values on the Y-axis. That is what I am trying to do: to investigate the correlation between these datasets. The slice and surf function did not help here.
Any suggestion how to do this?
Thanks,
Ferry

カテゴリ

質問済み:

2020 年 10 月 13 日

編集済み:

2022 年 1 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by