how to compute inverse of interpn function
Mostra commenti meno recenti
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.
1 Commento
Vijay Anand
il 2 Dic 2016
Risposte (1)
bio lim
il 2 Dic 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
rng shuffle
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);
end
If we plot the above,
figure(1)
grid on
plot(x1,x2,'-k');
title('V = 5')
xlabel('x1');
ylabel('x2');
We get:

Categorie
Scopri di più su Interpolation in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
