Is there a way to plot a contour with a 3-Dimensional matrix?
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I've asked a lot of questions here recently but I am coming to the business end of my project and the stuff I am trying to do is complex.
I have a 3-D matrix that is 40x180x40, full of scalars. They are all a function of the variables that give it the second two dimensions (so, the 180x40) so it is these values I want on the X and Y axes, and then the colour be determined by the values inside the 3-D matrix. Is this possible?
8 commentaires
jonas
le 4 Août 2018
Modifié(e) : jonas
le 5 Août 2018
Makes sense! You cannot plot the entire data set on a surface. You can plot a slice of your 3d matrix as a surface, but not the entire data set. I would try scatter3 with color coding, it may end up looking OK.
Start by something like this:
[X Y]=meshgrid(1:40,1:180);
A=randn(40,180,40);
X=repmat(X,1,1,40);
Y=repmat(Y,1,1,40);
scatter3(X(:),Y(:),A(:),[],A(:),'.');
colorbar
As you can see, this blob has a thickness and cannot be represented as a surface.
Réponses (3)
Steven Lord
le 5 Août 2018
I'm not certain, but from your description I think you might want an isosurface.
0 commentaires
Harvey Rael
le 7 Août 2018
1 commentaire
jonas
le 7 Août 2018
Modifié(e) : jonas
le 7 Août 2018
You cannot stack contourf plots, because they are all plotted in the same plane. If you want to make something meaningful of this stack, then you have to adjust the hidden property "ContourZLevel". You will get something like this:
40 stacked plots will make for a colorful but unreadable image :)
See my answer for a better method.
Voir également
Catégories
En savoir plus sur Contour 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!