corrlin.m

来自「Kriging插值工具箱」· M 代码 · 共 39 行

M
39
字号
function  [r, dr] = corrlin(theta, d)%CORRLIN  Linear correlation function,%%           n%   r_i = prod max(0, 1 - theta_j * d_ij) ,  i = 1,...,m%          j=1%% If length(theta) = 1, then the model is isotropic:% all theta_j = theta .%% Call:    r = corrlin(theta, d)%          [r, dr] = corrlin(theta, d)%% theta :  parameters in the correlation function% d     :  m*n matrix with differences between given data points% r     :  correlation% dr    :  m*n matrix with the Jacobian of r at x. It is%          assumed that x is given implicitly by d(i,:) = x - S(i,:), %          where S(i,:) is the i'th design site. % hbn@imm.dtu.dk  % Last update April 12, 2002[m n] = size(d);  % number of differences and dimension of dataif  length(theta) == 1  theta = repmat(theta,1,n);elseif  length(theta) ~= n  error(sprintf('Length of theta must be 1 or %d',n))endtd = max(1 - abs(d) .* repmat(theta(:).',m,1), 0);r = prod(td, 2);if  nargout > 1  dr = zeros(m,n);  for  j = 1 : n    dr(:,j) = prod(td(:,[1:j-1 j+1:n]),2) .* (-theta(j) * sign(d(:,j)));  endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?