Two dimensional cubic spline interpolation - does the order matter?

조회 수: 28 (최근 30일)
Zsolt Macskasi
Zsolt Macskasi 2014년 6월 4일
댓글: Zsolt Macskasi 2014년 6월 4일
Hi,
I am doing two-dimensional interpolation, using cubic splines. I have an M-by-N matrix of function values: z(m,n), and a vector of x-values (of length M) and a vector of y values (of length N). The task is to calculate the function value at (x*,y*), where this point is somewhere in the interior of the two-dimensional grid. In order to have a twice-differentiable interpolating function, I am using cubic splines.
My understanding is that Matlab's interp2 procedure does something that is commonly referred to as bicubic splines. Essentially, this is what it does. First, it performs M one-dimensional splines across the rows of the table, and for each of those splines, it calculates the function values at (xm,y*), for m=1,2,...,M. Then, it does one additional one-dimensional spline down the newly created column {(xm,y*)}.
My question is this: does it matter in which order do I choose the dimensions? In other words, if the first step was N one-dimensional splines across the columns of the table, followed by a one-dimensional spline across the newly created row - would I still get the same result?
My conjecture is that the answer is yes. When I do this numerically, the order does not seem to matter, I get practically the same answer. Also, it is straightforward to prove that if the interpolation was linear (bilinear), then again, the order would not matter. For cubic interpolation, the answer is less obvious. I tried to see what the literature says, but I could not find anything definitive.
Also, if the order does not matter in two-dimensions, it should not matter in three or more dimensions either, right?
Any thoughts?
Thank you,
Zsolt

채택된 답변

Matt J
Matt J 2014년 6월 4일
편집: Matt J 2014년 6월 4일
No, the order should not matter for any separable interpolator in any dimension, except for small floating point noise. Floating point errors do depend on the order of the computations.
  댓글 수: 3
Matt J
Matt J 2014년 6월 4일
편집: Matt J 2014년 6월 4일
Zsolt,
One way to see the order independence is to note that 1D interpolation is a linear operation on the column vector of data x being interpolated. Thus, it can be represented as a matrix multiplication
result = K*x
This is true of all interpolation weighting schemes, linear, cubic, spline, or whatever.
As you pointed out, 2D interpolation of a matrix X correponds to 1D interpolation across the rows of X, hence a linear transformation K1*X of all the columns of X, followed by a 1D interpolation across the columns, hence
result = (K1*X)*K2.'
But because of the associativity of matrix multiplication, this can also be expressed
result = K1*(X*K2.')
equivalent to interpolating across the columns first, then the rows. So, the order doesn't matter.
Zsolt Macskasi
Zsolt Macskasi 2014년 6월 4일
Aha, that is a very good point. Thanks a lot.

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

추가 답변 (0개)

카테고리

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