% interp2_fa ( x, y, Z, xi, yi, METHOD ) % ------------------------------------------------------------------------- % % Two-dimensional data interpolation using bin/brightness matching % (flat aperture resampling). Grids (x, y and xi, yi values) must be % evenly spaced. % % USE: Zi = interp2( x, y, Z, xi, yi, METHOD ) % Zi = interp2( Z, xi, yi, METHOD ) % % NOTE: Currently x's spacing must be 1, and go from 0:n. % Also, xi not restricted to x's range (Should be limited to +- 1/2). % % % Same usage as Matlab's interp2.m, except for grid spacing requirements. % Zi = interp1(x, Y, xi) returns vector Zi containing elements % corresponding to the elements of xi and determined by interpolation % within vectors x and Y. The vector x specifies the points at which % the data Y is given. If Y is a matrix, then the interpolation is % performed for each column of Y and yi will be length(xi)-by-size(Y,2). % % Out of range values !!![should be]!!!! returned as NaNs. % % METHOD - The default is linear interpolation. % 'linear' linear interpolation % 'quadratic' piecewise quadratic interpolation % % FUNCTION CALLS: % % interp2_fa.m % % Mark Dow, April 1999 % Mark Dow, modified March 2007, derived from interp1_bm % Mark Dow, modified May 2007 function Zi = interp2_fa ( x, y, Z, xi, yi, METHOD ) % First two argument can be ignored: must be 1:N where n is number % of columns and number of rows of matrix. Fix up arguments. if nargin == 4 METHOD = xi; yi = Z; xi = y; Z = x; x = 1:size(Z,2); y = 1:size(Z,1); end Zfp = interp1_fa( y, Z, yi, METHOD ); Zi = ( interp1_fa( x', Zfp', xi, METHOD ) )';