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!





