필터 지우기
필터 지우기

how to compute inverse of interpn function

조회 수: 17 (최근 30일)
Vijay Anand
Vijay Anand 2016년 12월 2일
답변: bio lim 2016년 12월 2일
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
Vijay Anand
Vijay Anand 2016년 12월 2일
I further add to understand this problem. In 2D sense, if V = f(x1,x2) and to make it simple, V = x1 + x2.
Now, the matrix V looks like this.
The problem is, if we ask for x1,x2 values corresponding to say V = 5, there are infinite solutions exists. (1,4), (2,3), (1.1,3.9), (-5.5,10.5).
So, the right answer is anypoint on this line. Depending on the function V = f(x,y), this line may become a curve / spline. Even continuity of the curve is also not guaranteed !!!
So, for 2D problem, we are looking for a curve with some data points.
similarly, for a 3D problem, we are looking for a matrix ie a plane with data points...
Hope i made it clear.... cheers vijay

댓글을 달려면 로그인하십시오.

답변 (1개)

bio lim
bio lim 2016년 12월 2일
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:

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by