Problems working with 3D surface

6 views (last 30 days)
Joe J
Joe J on 27 Jan 2012
Hi, I'm pretty new to Matlab and I'm using it to model a sedimentary basin. I constructed a 3D basin that is shaped like a truncated, elliptical cone. I'm trying to delineate the shoreline whenever water level changes in the basin. My approach has been to locate all the values in the Z matrix (the one that contains the surface points of the 3D basin) that are equal to the current value in the array that holds all the water level info. Sounds simple enough, since these points in the Z matrix should delineate the shoreline at a given water level.
Here's the problem. Because the basin is elliptical, if you were to walk around the perimeter of the basin, the slope down to the bottom of the basin would change as you traversed the perimeter. In other words, the elevation gradient is not the same everywhere, so a value that is present in one column of the Z matrix may be missing from several others. For any given water level, when I delineate the shoreline, I'm left with large gaps instead of a closed contour.
I can plot a planar surface that represents the water level that gives a pretty good approximation of the shoreline. If I could trace the perimeter of this surface it would probably due, but I'm not sure how to do it.
Alternatively, is there a way to increase the grid resolution where the elevation gradient is steeper so I don't skip values? Not sure I want to do this since it would complicate subsequent calculations.
Any advice would be appreciated.
Thanks.

Answers (1)

Walter Roberson
Walter Roberson on 27 Jan 2012
contour() can construct isolines, including doing gradient interpolation.
  2 Comments
Joe J
Joe J on 27 Jan 2012
Thanks. Is there any way to retrieve the row,column indices of the points that make up the isoline?
Walter Roberson
Walter Roberson on 27 Jan 2012
The points that make up the isoline are interpolated points, so row and column indices are not relevant.
You can use the return values,
[C, h] = contour(x,y,Z);
or if you do not need the graph, you can call contourc() directly.
The C matrix returned is a contour matrix; http://www.mathworks.com/help/techdoc/creating_plots/f10-2524.html#f10-2614
If you want to know the nearest matrix coordinates to an interpolated x-y coordinate pair, you can interp1() with 'nearest' of the interpolated x against the known x, and interpolated y to the known y, and then match against the known x and y to get the indices, such as by using ismember() with multiple output arguments.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!