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

1 次查看(过去 30 天)
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 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by