www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgmathsobject/private/extrapolate_RBF.m

    function V = extrapolate_RBF(X, Y, Z, BPx, BPy)
%EXTRAPOLATE_RBF Extrapolate values onto a grid using a RBF
%
%  V = EXTRAPOLATE_VALUES_RBF(X, Y, Z, BPx, BPy) extrapolates from a
%  defined set of values (X, Y, Z) to generate the entire values table at
%  the gridpoints BPx, BPy.
%
%  Six basic cases are dealt with:
%
%  1. X, Y, Z specified as empty, in which case we set the output to be
%     empty.
%
%  2. Only one point specified, in which case we set the output to a
%     constant matrix with this value.
%
%  3. Colinear data is given, in which case we will produce a surface
%     obtained by translating this line along a vector perpendicular to the
%     direction of the line and the z axis.
%
%  4. Three non colinear points are given, in which case they define a
%     plane and we use this to provide our values.
%
%  5. The same number of points as there are evaluation gridpoints is
%     given, and every point lies exactly on a different gridpoint, i.e.
%     every gridpoint has a single exact data value.
%
%  6. More than 3 points are interpolated and extrapolated using an RBF
%     interpolant model.

%  Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.


if numel(X)~=numel(Z) || numel(Y)~=numel(Z)
    error(message('mbc:extrapolate_RBF:InvalidArgument'));
end

% Create grid of points
[xgrid, ygrid] = meshgrid(BPx,BPy);

% Perform extrapolation
V = extrapolate_RBF_points(X, Y, Z, xgrid(:), ygrid(:));

% Reshape to be a grid
if ~isempty(V)
    V = reshape(V, size(xgrid));
end