1

Is it possible to achieve bi-cubic interpolation beyond grid values? For example:

L = [5,10,20,25,40];
W= 1:3;
S= [50 99 787
    779 795 850
    803 779 388
    886 753 486
    849 780 598];
size1 = griddata(W,L,S,2,40,'cubic')
sizeBeyond = griddata(W,L,S,2,41,'cubic')
sizeV4 = griddata(W,L,S,2,41,'v4')

returns:

size1 = 780

sizeBeyond = NaN

sizeV4 = 721.57
Mary
  • 788
  • 6
  • 19
  • 43
  • Why don't you input the extrapolated values instead.....? – Siva Srinivas Kolukula Jun 08 '17 at 09:25
  • 1
    `griddata(...,'cubic')` uses cubic splines to interpolate within a triangle of given points. How should this be converted into an extrapolation in your opinion? – flawr Jun 08 '17 at 09:26
  • @flawr, I am not sure if it is at all possible, but wanted to check. Was looking at something like this (http://uk.mathworks.com/matlabcentral/fileexchange/8998-surface-fitting-using-gridfit) but using a cubic method if possible. Does not necessarily need to use griddata, but my points are scattered and not regularly spaced. – Mary Jun 08 '17 at 09:55
  • Well the "problem" with polynomials is that they behave really bad. Outside of your point cloud you're just going to get a cubic polynomial, which "explodes" really fast, so except for the case where actually want to find a polynomial, they are usually not good for extrapolation. – flawr Jun 08 '17 at 10:02
  • Ah. good to know. Thank you. – Mary Jun 08 '17 at 10:32

1 Answers1

0

What I was suggesting is, you can input the values which are extrapolated. Check the below code. But note that, as suggested by flawr, the extrapolation behave really bad.

l = [5,10,20,25,40];
w = 1:3;

li = [l 41] ;

S = [50 99 787
    779 795 850
    803 779 388
    886 753 486
    849 780 598];
[W,L] = meshgrid(w,l) ;
[Wi,Li] = meshgrid(w,li) ;
Si = interp2(W,L,S,Wi,Li,'spline') ;

size1 = griddata(W,L,S,2,40,'cubic')
sizeBeyond = griddata(Wi,Li,Si,2,41,'cubic')
sizeV4 = griddata(W,L,S,2,41,'v4')

Note: Don't use inbuilt commands like length,size etc as variables in the code, even for demonstration, it is trouble some.

Though, this is not answer, I have to post it here as for discussion.

Siva Srinivas Kolukula
  • 1,251
  • 1
  • 7
  • 14