how to compute inverse of interpn function
16 views (last 30 days)
I am looking for the inverse operation of interpn (VI=interpn(X1,X2,X3,X4,V,Y1,Y2,Y3,Y4)
[Y1,Y2,Y3,Y4] = inv_interpn(X1,X2,X3,X4,V,V1).
Y1,Y2,Y3,Y4 can be scalar, if only single solution exist. or it can be a vector is 2 or more solutions exist.
Linear interpolation between the grid points is good enough.
Please help me.
bio lim on 2 Dec 2016
This is how you should approach the problem. Let's study the case when V=5.
Let's say we generate 100 possible combinations of x1 and x2 that sum up to 5.
x1 = zeros(200,1);
x2 = zeros(200,1);
Now, we use an iteration to generate a random number, and we "scale" it.
for i = 1:200
X = rand(2,1,'double');
V = 5;
X = X/sum(X)*V;
X(1) = X(1) - (V-sum(X));
x1(i) = X(1);
x2(i) = X(2);
If we plot the above,
title('V = 5')