How to plot 3-D grid data in scatter plot?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ferry Nieuwland
le 13 Oct 2020
Modifié(e) : Jorg Herwanger
le 14 Jan 2022
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 commentaire
Jorg Herwanger
le 17 Août 2021
Modifié(e) : Jorg Herwanger
le 14 Jan 2022
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.
Réponse acceptée
KSSV
le 13 Oct 2020
Modifié(e) : KSSV
le 13 Oct 2020
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 commentaires
KSSV
le 13 Oct 2020
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.
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Scatter Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!