MATLAB Answers

How do you plot an elevation line across a mesh dataset?

14 ビュー (過去 30 日間)
John Hart
John Hart 2017 年 4 月 20 日
コメント済み: John Hart 2017 年 4 月 28 日
I want to plot a line graph showing how elevation changes along the x or y axis. I want to be able to control the x or y intercept and see how elevation changes across a transect. I have x,y and z data which has been interpolated using
xi=linspace(min(x),max(x),1000) yi=linspace(min(y),max(y),1000) [xi yi]=meshgrid(xi,yi) zi=griddata(x,y,z,xi,yi)
Is there an easy way of producing simple plot line graphs that show how elevation (z) changes along different transects (e.g yi = 20,25,30,35,40).
Any help would be much appreciated!
John

  0 件のコメント

サインインしてコメントする。

採用された回答

Ankit Bhardwaj
Ankit Bhardwaj 2017 年 4 月 24 日
There can be multiple ways to do this.
1. You can use 'find' function to find the indices when yi has a constant value (e.g. yi = 20), and then use those indices to find the corresponding values of xi and zi. You can follow the same steps for finding xi and zi values corresponding to other yi values (such 25, 30, 35 etc.). Finally you can use these values to plot trend lines on a 3d plot. For more information on 'find' function, please go through the following documentation.
https://www.mathworks.com/help/releases/R2017a/matlab/ref/find.html
2. You may also use 'slice' function. Please go through the following documentation to learn more about this.
https://www.mathworks.com/help/releases/R2017a/matlab/ref/slice.html

  1 件のコメント

John Hart
John Hart 2017 年 4 月 28 日
Many thanks, the find function did the job!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by