So you've probably worked out that this is creating a anonymous function with the handle interpolate
:
interpolate = @(x, y, h, x_new, y_new)...
interpolate
takes those five inputs, and calls feval
. Now here it gets a bit tricky, because feval
itself contains another anonymous function.
@(int) int(x_new, y_new)
, means, take input int
and return the output of int(x_new,y_new)
. The additional input to feval
, in this case TriScatteredInterp
, is taken as the input to that anonymous function. This is not a reference to a built-in function int
(as might be the case if you saw something starting feval(@int...
).
So what interpolate
does is basically equivalent to doing this, for any given set of inputs:
tsi = TriScatteredInterp([-1; -1; 1; 1; x], ...
[-1; 1; -1; 1; y], ...
[0; 0; 0; 0; h]));
tsi(x_new,y_new)
You can test this by comparing the output of tsi(x_new,y_new)
with the output of interpolate(x, y, h, x_new, y_new)
.