How to create contour plot to show height?
Afficher commentaires plus anciens
I want to create a countour plot such that my x axis and y axis are the coordinates of the plane and my z axis is height. I want to creat a 2b plot (contour) such that my height is differentiated with color. My z value has no relation with xy value other that the first value of z is corresponding to the cobination of first two values of x and y.
For example my x, y and z vectors are:
AAA=1:1:1000;
BBB=1:1:1000;
CCC=2:2:2000;
3 commentaires
DGM
le 18 Mar 2022
if there's no correlation between Z and X,Y, then you don't have a meaningful description of a 2D dataset.
If the x,y,z vectors are correlated, but scattered, then use griddata() to create gridded data that's compatible with what contour() expects.
Muhammad Qaisar Fahim
le 18 Mar 2022
DGM
le 18 Mar 2022
Okay, yeah. That's just scattered data. Walter's suggestion looks pretty good.
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 18 Mar 2022
0 votes
2 commentaires
Muhammad Qaisar Fahim
le 18 Mar 2022
Modifié(e) : Walter Roberson
le 19 Mar 2022
Walter Roberson
le 19 Mar 2022
The first parameter to tricontour() needs to be the xy coordinates, each row being an x y pair.
The second parameter to tricontour() needs to be the triangular connectivity data.
You might want to use https://www.mathworks.com/help/matlab/ref/delaunaytriangulation.html and extract the Points and ConnectivityList properties of the result.
Catégories
En savoir plus sur Red dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





