How to get a y value from x and z values when data is in a grid

1 view (last 30 days)
I have generated a surface based on reservoir elevation (x), spillway gate height opening (y), and discharge (z) based on a spillway rating curve. I would like to be able to enter a reservoir level (x) and a discharge(z) and get back an interpolated gate height (y) from the surface.
Does anybody know of a way to do this simply?
Thanks, Amanda

Answers (2)

Image Analyst
Image Analyst on 19 Jun 2014
If they're integers:
logicalIndexes = yourSurface(:, x) == zTarget % Note: x is column so it's dimension #2.
y = find(logicalIndexes)

Star Strider
Star Strider on 19 Jun 2014
My approach would be to experiment with interp2 or interp3, depending on what you find is most appropriate for your data.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!