Kriging call matlab toolbox

Kriging

Kriging is a spatial regression modeling and interpolation algorithm based on random or stochastic processes covariance function.

Kriging interpolation formula is:

 

Heavy metal pollution values ​​for each point to be inserted in the formula, known as the heavy metal pollution point value for each point of the right weight value.

Solving the kriging weights with weight BLUP theory:

The estimate of random variables represented as a linear system including random error, the selection can be expressed as a linear BLUP system parameters to minimize the variance of the estimated value and the true value:

 

 

Wherein the unknown point, {random sample of, for the weight coefficient, commonly referred to as kriging weights. Known variance defined by mathematical expectation when the estimated value and the true value of the same, both the smallest variance

 

BLUP weight of solution to the above-described weight coefficients comprises covariance function between the sample point and the unknown point.

    Kriging is a very useful in many areas of Statistic grid method, it is consistent with the problem of the concentration distribution of pollutants, and the results of Kriging produces more natural, can effectively avoid outliers , can also give the standard error, thanks Kriging algorithm takes into account the estimated position and the mutual relationship between the point of a known point, also consider the relationship between the known point. Therefore, better distribution of objective response pollutants, it is relatively high accuracy of the estimates.

code show as below

Sample% topographic mapping 
CLC, Clear 
Data = xlsread ( 'zz.xls', 'Annex 1', 'B4: D322' );% read the file 
% obtain data 
S = Data (:,. 1: 2); 
the Y = Data (:,. 3); 
% using Kriging 
    theta = [10 10]; lob = [1e-1 1e-1]; upb = [20 20];% parameter 
    % Kriging interpolation algorithm toolbox calls 
    % fitting operation 
    [dmodel, Perf] = dacefit (S, the Y, @ regpoly0, @corrspherical, Theta, LOB, UPB) 
    m = 100; 
    % interpolation calculation 
    X = gridsamp ([0 0; 30000 20000], m) ; 
    [YX the MSE] = Predictor (X-, dmodel); 
    % get an interpolated 
    the X1 = the RESHAPE (X-(:,. 1), m, m); an X2 = the RESHAPE (X-(:, 2), m, m); 
    YX = the RESHAPE (YX, size (the X1)); 
    % plot 
    Figure; 
    Surf (the X1, an X2, YX) 
    HOLD ON,   
    HOLD OFF 
    the xlabel ( 'X / m')
    ylabel ( 'Y / m') 
    zlabel ( 'altitude') 
    title ( 'sampled topographic map') 
    Figure; 
    contourf (the X1, an X2, YX)% do plan 
    [C, h] = contour (   X1, X2, YX); 
    CLabel (C, H) 
    the xlabel ( 'X / m') 
    ylabel ( 'Y / m') 
    zlabel ( 'altitude') 
    title ( 'sampled topographic map') 

% contaminant concentration distribution 
CLC, Clear 
B = { 'of As' , 'of Cd', 'of Cr', 'a Cu', 'Hg', 'of Ni', 'Pb', 'a Zn'}; 
Nd = xlsread ( 'zz.xls', 'Annex 2', 'B4: I322' ); read files% 
S = xlsread ( 'zz.xls', ' Annex 1', 'B4: C322' );% read the file 
% loop to read data 
for I =. 1:. 8 
    the Y = FIX (Nd (: , I)); 
    % using Kriging 
    theta = [10 10];lob = [1e-1 1e- 1]; upb = [20 20];% parameter 
    % call Kriging algorithm toolbox 
    % fitting operation
    [dmodel, Perf] = dacefit (S, the Y, @ regpoly0, @corrspherical, Theta, LOB, UPB) 
    m = 100; 
     % calculated interpolation 
    X-gridsamp = ([0 0; 30000 20000], m); 
    [YX the MSE] = Predictor (X-, dmodel); 
    % get an interpolated 
    the X1 = the RESHAPE (X-(:,. 1), m, m); an X2 = the RESHAPE (X-(:, 2), m, m); 
    YX = the RESHAPE (YX, size (the X1)); 
    % plot 
    Figure; 
    Mesh (the X1, an X2, YX) 
    HOLD ON,   
    HOLD OFF 
    the xlabel ( 'X / m') 
    ylabel ( 'Y / m') 
    zlabel ( 'concentration') 
    title ([B ( I)]) 
    Figure; 
    contourf (the X1, an X2, YX) 
    % do plan 
    [C, H] = Contour (the X1, an X2, YX); 
    the xlabel ( 'X / m') 
    ylabel ( 'Y / m') 
    zlabel ( 'concentration'))
    title([b(i)])
end

  You need to call toolkit files

In my Baidu cloud disk there, I hope to help you

Link: https: //pan.baidu.com/s/1O-mqKowNBJ06llEldHu90A
extraction code: g4wl

Guess you like

Origin www.cnblogs.com/zq-dmhy/p/11288080.html