MATLAB Answers

Possible to contour at specific z planes to give the x,y coords?

47 views (last 30 days)
Wthee
Wthee on 23 Sep 2020 at 20:24
Commented: Walter Roberson on 1 Oct 2020 at 19:39
Given these vectors:
We are dealing with UTM coords here, and we have: Northings, Eastings, and gridded Elevation-values.
dimensions--
x is 1x30
y is 1x41
z is 41x30
and Given this code:
[X,Y]=meshgrid(x,y);%assume this is what you want
dataTemp=[X(:),Y(:),z(:)];
data = rmmissing(dataTemp)
The Followup question:
Is there a way to have contour outputs at certain z values? E.g., somehow setting z = 0 and finding all x,y coords that intersect that plane? I'm guessing there would have to be interpolation involved?

  0 Comments

Sign in to comment.

Answers (1)

KSSV
KSSV on 24 Sep 2020 at 3:44
You can use contour to do this. You need to specify the level as 0 to get your coordinates (x,y) where Z = 0.
C = contour(X,Y,Z,[0 0]) ;

  4 Comments

Show 1 older comment
Walter Roberson
Walter Roberson on 27 Sep 2020 at 2:29
There is a file exchange contribution that can decode the contour matrix output into lists of vertices that form the contour outlines. You can use those to interpolate the boundaries such as poly2mask and boundary trace to get a complete list of visited pixels.
The time you would not do this is if you need higher resolution, if you need the intercepts to subpixel boundaries. But in such a case you would be at the mercy of the accuracy of the contour estimation algorithm compared to the reality of your measurements. If you are not using LiDAR then it is questionable that high accuracy could be justified.
Wthee
Wthee on 1 Oct 2020 at 19:03
That level of resolution isn't necessary.
I'm really just trying to see if griddata can solve my issue as there are many gaps for z values. I would like to have x and y interpolated for z at possible intervals of .1 or .01. from a bit above the surface to typical fault depth.
I don't know if I have presented to case well enough for you to be able to help.
Thanks for the efforts so far.
Walter Roberson
Walter Roberson on 1 Oct 2020 at 19:39
contour3 and provide the level list. The graphics objects that result will have ZData properties corresponding to the z level; regular contour() sets the ZData to 0. XData and YData coordinates give you the edges.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by