1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
% STK_RBF_GAUSS computes the Gaussian correlation function
%
% CALL: K = stk_rbf_gauss (H)
%
% computes the value of the Gaussian correlation function at distance H.
%
% CALL: K = stk_rbf_gauss (H, DIFF)
%
% computes the derivative of the Gaussian correlation function with respect
% to the distance H if DIFF is equal to 1. If DIFF is equal to -1, this is
% the same as K = stk_rbf_gauss (H).
%
% NOTES:
%
% * This correlation function is also known as the "squared exponential" corre-
% lation function, or the "Gaussian RBF" (Radial Basis Function).
%
% * The Gaussian correlation function is a valid correlation function for all
% dimensions.
%
% * The Gaussian correlation function is the limit of the Matern correlation
% function when the regularity parameters tends to infinity.
%
% See also: stk_rbf_matern, stk_rbf_matern52
% Copyright Notice
%
% Copyright (C) 2016, 2018 CentraleSupelec
% Copyright (C) 2013 SUPELEC
%
% Author: Julien Bect <julien.bect@centralesupelec.fr>
% Copying Permission Statement
%
% This file is part of
%
% STK: a Small (Matlab/Octave) Toolbox for Kriging
% (http://sourceforge.net/projects/kriging)
%
% STK is free software: you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free
% Software Foundation, either version 3 of the License, or (at your
% option) any later version.
%
% STK is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
% License for more details.
%
% You should have received a copy of the GNU General Public License
% along with STK. If not, see <http://www.gnu.org/licenses/>.
function k = stk_rbf_gauss (h, diff)
% default: compute the value (not a derivative)
if nargin < 2,
diff = -1;
end
if diff <= 0, % value of the covariance function
k = exp (- h .^ 2);
elseif diff == 1, % derivative wrt h
k = - 2 * h .* exp (- h .^ 2);
else
error ('incorrect value for diff.');
end
end % function
%!shared h, diff
%! h = 1.0; diff = -1;
%!error stk_rbf_gauss ();
%!test stk_rbf_gauss (h);
%!test stk_rbf_gauss (h, diff);
%!test % h = 0.0 => correlation = 1.0
%! x = stk_rbf_gauss (0.0);
%! assert (stk_isequal_tolrel (x, 1.0, 1e-8));
|