Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
John Hart
John Hart le 20 Avr 2017
Commenté : John Hart le 28 Avr 2017
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

Réponse acceptée

Ankit Bhardwaj
Ankit Bhardwaj le 24 Avr 2017
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 commentaire
John Hart
John Hart le 28 Avr 2017
Many thanks, the find function did the job!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by