-
大小: 44KB文件类型: .zip金币: 2下载: 1 次发布日期: 2021-06-04
- 语言: Matlab
- 标签: 克里金 Co-Kriging
资源简介
本资源利用matlab实现了克里金及协同克里金插值代码,里面包含测试代码和相应的测试数据,绝对真实可靠。
代码片段和文件信息
function [zis2zi] = Co_kriging0(vstruct_1vstruct_2vstruct_12vstruct_21x1y1z1x2y2z2xiyichunksize)
% x1 y1 z1 表示主变量的坐标及观测值
% x2 y2 z2 表示辅助变量的坐标及观测值
% xi yi 表示待估位置坐标
% chunksize 如果待插值位置过多,分组进行插值,此处chunksize表示每组的个数
% interpolation with ordinary kriging in two dimensions
%
% Syntax:
%
% [zizivar] = kriging(vstructxyzxiyi)
% [zizivar] = kriging(vstructxyzxiyichunksize)
%
% Description:
%
% kriging uses ordinary kriging to interpolate a variable z measured at
% locations with the coordinates x and y at unsampled locations xi yi.
% The function requires the variable vstruct that contains all
% necessary information on the variogram. vstruct is the forth output
% argument of the function variogramfit.
%
% This is a rudimentary but easy to use function to perform a simple
% kriging interpolation. I call it rudimentary since it always includes
% ALL observations to estimate values at unsampled locations. This may
% not be necessary when sample locations are not within the
% autocorrelation range but would require something like a k nearest
% neighbor search algorithm or something similar. Thus the algorithms
% works best for relatively small numbers of observations (100-500).
% For larger numbers of observations I recommend the use of GSTAT.
%
% Note that kriging fails if there are two or more observations at one
% location or very very close to each other. This may cause that the
% system of equation is badly conditioned. Currently I use the
% pseudo-inverse (pinv) to come around this problem. If you have better
% ideas please let me know.
%
% Input arguments:
%
% vstruct structure array with variogram information as returned
% variogramfit (forth output argument)
% xy coordinates of observations
% z values of observations
% xiyi coordinates of locations for predictions
% chunksize nr of elements in zi that are processed at one time.
% The default is 100 but this depends largely on your
% available main memory and numel(x).
%
% Output arguments:
%
% zi 协同克里金预测值
% zivar 协同克里金方差
%
% Date: 2018-03-31
% Author: SQ
%判断是否有NaN值
II1 = (isnan(x1) | isnan(y1) | isnan(z1));
x1(II1:) = []; y1(II1) = []; z1(II1) = [];
II2 = (isnan(x2) | isnan(y2) | isnan(z2));
x2(II2:) = []; y2(II2) = []; z2(II2) = [];
% size of input arguments
sizest = size(xi);
numest = numel(xi);
numobs_1 = numel(x1);
numobs_2 = numel(x2);
numobs = numobs_1 + numobs_2;
% force column vectors
xi = xi(:);
yi = yi(:);
x1 = x1(:);
y1 = y1(:);
z1 = z1(:);
x2 = x2(:);
y2 = y2(:);
z2 = z2(:);
if nargin == 12;
chunksize = 100;
elseif nargin == 13;
else
error(‘wrong number of input arguments‘)
end
% check if the latest version of variogramfit is used
i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-31 16:06 克里金及协同克里金代码\
文件 8758 2018-03-31 16:15 克里金及协同克里金代码\Co_kriging0.m
文件 12325 2018-03-31 16:13 克里金及协同克里金代码\Co_variogram_sq.m
文件 8139 2012-02-06 06:53 克里金及协同克里金代码\fminsearchbnd.m
文件 6687 2018-03-31 15:37 克里金及协同克里金代码\kriging0.m
文件 1811 2018-03-31 16:06 克里金及协同克里金代码\Test.m
文件 18796 2018-03-30 09:04 克里金及协同克里金代码\Test_data.mat
文件 12698 2018-03-27 11:03 克里金及协同克里金代码\variogram.m
文件 18370 2018-03-31 15:56 克里金及协同克里金代码\variogramfit2.m
评论
共有 条评论