How to get a y value from x and z values when data is in a grid
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (2)
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)
if yourSurface and zTarget are floating point, see the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
0 Comments
See Also
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!