griddata() does not have the option for extrapolation beyond the data-points. You can use scatteredInterpolant for this; however, it does not have a cubic interpolation option, and the extrapolation is also linear.
P = [0 0 0;
20 0 5;
0 20 5 ;
5 5 2;
10 10 10 ;
20 20 10] ;
x = P(:,1) ; y = P(:,2) ; z = P(:,3) ;
ti = 0:1:30;
[XI, YI] = meshgrid(ti,ti);
model = scatteredInterpolant(x, y, z, 'linear', 'linear');
ZI = model(XI, YI);
surf(XI,YI,ZI), hold
plot3(x,y,z,'ro'), hold off
colorbar
The best way to handle such cases is to have an equation of form z = f(x, y) and then use curve-fitting to estimate the unknown parameter in f(.). Then you can use f(.) to extrapolate the values.
Best Answer