How to create contour plot to show height?
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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 月 19 日
        You can always try just using griddata()
S = load('scattered.mat'); % load scattered data
n = 100;
x = linspace(min(S.x),max(S.x),n);
y = linspace(min(S.y),max(S.y),n);
[xg yg] = meshgrid(x,y); % create new grid
zg = griddata(S.x,S.y,S.z,xg,yg); % interpolate scattered data to grid
contour(xg,yg,zg) % now you can use contour(), contourf(), surf(), etc
その他の回答 (1 件)
  Walter Roberson
      
      
 2022 年 3 月 18 日
        2 件のコメント
  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.
参考
カテゴリ
				Help Center および File Exchange で Red についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!









