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

조회 수: 2 (최근 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

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by