reverse of interpolation.....
Show older comments
I have a function V that is computed from two inputs (X,Y). I am using a grid of points and performing 2d interpolation.
X = [1,2,3];
Y = [1,2,3];
V =[3,4,5;6,7,8;9,10,11];
Is is easy to obtain V for any combination of (X,Y), for example:
Vq = interp2(X,Y,V,1.8,2.5)
Vq = 8.3000
I now want to inverse that function and for fixed V, how one can find respective X, Y?
Thank you in advance.
4 Comments
KSSV
on 5 Jul 2016
Well, you have your own answer: Use contour for the values you are interested in. There are quite a few algortihms to get isolines. Looking at contour.m does not say much about how it's done so if you want the details you'd have to ask the Mathworks I guess.
John D'Errico
on 5 Jul 2016
I added an answer that explains how a contour tool does its job.
Accepted Answer
More Answers (2)
José-Luis
on 5 Jul 2016
0 votes
Some time ago, contourc() the low-level function on which contour() is based, used to do it through linear interpolation. That might have changed, but since contourc() is a built-in function, the implementation is hidden from the user.
Star Strider
on 5 Jul 2016
0 votes
I would experiment with the contour function. You can have contour return the (x,y) coordinates for a specific value or range of values of ‘V’. (This is a common way of determining the zeros of a bivariate function.) See the contour documentation for Display Single Contour Line for details.
Returning the (x,y) coordinates for a specific value of ‘V’ requires that you use the first column for a specific value to determine the value (first row), and the number of (x,y) pairs that contour calculates (second row).
Categories
Find more on Surface and Mesh Plots 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!