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!





