How to create contour plot to show height?
显示 更早的评论
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 个评论
DGM
2022-3-18
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
2022-3-18
DGM
2022-3-18
Okay, yeah. That's just scattered data. Walter's suggestion looks pretty good.
采纳的回答
更多回答(1 个)
Walter Roberson
2022-3-18
0 个投票
2 个评论
Muhammad Qaisar Fahim
2022-3-18
编辑:Walter Roberson
2022-3-19
Walter Roberson
2022-3-19
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





