Re: Interpolations for Two and Three Independent Variables Message #6 Posted by Namir on 15 Nov 2011, 4:18 p.m., in response to message #3 by Namir
In the case of a biquadratic interolation, one can build the Vandermonde matrix A as
+ +
 1 x1 y1 x1^2 y1^2 x1*y1 
 
 1 x2 y2 x2^2 y2^2 x2*y2 
 
 1 x3 y3 x3^2 y3^2 x3*y3 
 
 1 x4 y4 x4^2 y4^2 x4*y4 
 
 1 x5 y5 x5^2 y5^2 x5*y5 
 
 1 x6 y6 x6^2 y6^2 x6*y6 
 
+ +
and the B vector as:
+ +
 f(x1,y1) 
 
 f(x2,y2) 
 
 f(x3,y3) 
 
 f(x4,y4) 
 
 f(x5,y5) 
 
 f(x6,y6) 
+ +
The coefficents in array C as obtaied by:
C = inverse(A) * B
To interpolate at point (Xint,Yint) use:
y = C(1) + C(2) * Xint + C(3) * Yint + C(4)*Xint^2 + C(5) * Yint^2 + C(6) * Xint * Yint
In the case of a triquadratic interolation, one can build the Vandermonde matrix A as
+ +
 1 x1 y1 z1 x1^2 y1^2 z1^2 x1*y1 x1*z1 y1*z1 x1*y1*z1 
 
 1 x2 y2 z2 x2^2 y2^2 z2^2 x2*y2 x2*z2 y2*z2 x2*y2*z2 
 
 1 x3 y3 z3 x3^2 y3^2 z3^2 x3*y3 x3*z3 y3*z3 x3*y3*z3 
 
 1 x4 y4 z4 x4^2 y4^2 z4^2 x4*y4 x4*z4 y4*z4 x4*y4*z4 
 
 1 x5 y5 z5 x5^2 y5^2 z5^2 x5*y5 x5*z5 y5*z5 x5*y5*z5 
 
 1 x6 y6 z6 x6^2 y6^2 z6^2 x6*y6 x6*z6 y6*z6 x6*y6*z6 
 
 1 x7 y7 z7 x7^2 y7^2 z7^2 x7*y7 x7*z7 y7*z7 x7*y7*z7 
 
 1 x8 y8 z8 x8^2 y8^2 z8^2 x8*y8 x8*z8 y8*z8 x8*y8*z8 
 
 1 x9 y9 z9 x9^2 y9^2 z9^2 x9*y9 x9*z9 y9*z9 x9*y9*z9 
 
 1 x10 y10 z10 x10^2 y10^2 z10^2 x10*y10 x10*z10 y10*z10 x10*y10*z10 
 
 1 x11 y11 z11 x11^2 y11^2 z11^2 x11*y11 x11*z11 y11*z11 x11*y11*z11 
 
+ +
and the B vector as:
+ +
 f(x1,y1,z1) 
 
 f(x2,y2,z1) 
 
 f(x3,y3,z3) 
 
 f(x4,y4,z4) 
 
 f(x5,y5,z5) 
 
 f(x6,y6,z6) 
 
 f(x7,y7,z7) 
 
 f(x8,y8,z8) 
 
 f(x9,y9,z9) 
 
 f(x10,y10,z10) 
 
 f(x11,y11,z11) 
+ +
The coefficents in array C as obtaied by:
C = inverse(A) * B
To interpolate at point (Xint,Yint,Zint) use:
y = C(1) + C(2) * Xint + C(3) * Yint + C(4) * Zint +
C(5) * Xint^2 + C(6) * Yint^2 + C(7) * Zint^2 +
C(8) * Xint * Yint + C(9) * Xint * Zint + C(10) * Yint * Zint +
C(11) * Xint + Yint + Zint
