correlation
    
    
    
      correlation,
      a MATLAB code which
      implements statistical correlation functions.
    
    
      The (nonstationary) correlation function c(s,t) must satisfy the 
      following properties:
      
        - 
           -1 ≤ c(s,t) ≤ +1;
        
 
        - 
           c(s,t) = c(t,s);
        
 
        - 
           c(s,s) = 1;
        
 
      
    
    
      Most of the correlation functions considered here determine the correlation of two
      random values y(x1) and y(x2), depending only on distance, that is,
      on the norm ||x1-x2||, which we will denote by "r".  Such correlation functions
      are called "stationary".
    
    
      The stationary correlation function c(r) must satisfy the following properties:
      
        - 
           -1 ≤ c(r) ≤ +1;
        
 
        - 
           c(0) = 1;
        
 
      
    
    
      It is often the case that a typical scale length "r0" is specified,
      called the "correlation length".  In that case, the correlation function
      may be expressed in terms of the normalized distance r/r0.
    
    
      Because correlation functions model physical situations, it is usually the case
      that the correlation function will smoothly and steadily decrease to 0 with r,
      or that it will oscillate between positive and negative values, with an 
      amplitude that is steadily decreasing.  One of the most popular correlation 
      functions is the gaussian correlation, which has many desirable statistical
      and mathematical properties.
    
    
      Correlation functions available include:
      
        - 
          besselj: 
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          besselk: 
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          brownian (nonstationary): 
          (plots),
          (sample paths)
        
 
        - 
          circular: 
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          constant: 
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          cubic:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          damped_cosine:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          damped_sine:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          exponential:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          gaussian:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          hole:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          linear:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          matern (NU=2.5):
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          pentaspherical:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          power (E=2.0):
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          rational_quadratic:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          spherical:
          (plot),
          (plots),
          (sample paths)
        
 
        - 
          white_noise:
          (plot),
          (plots),
          (sample paths)
        
 
      
    
    
      Licensing:
    
    
      The information on this web page is distributed under the MIT license.
    
    
      Languages:
    
    
      correlation is available in
      a C version and
      a C++ version and
      a Fortran90 version and
      a MATLAB version and
      an Octave version.
    
    
      Related Data and Programs:
    
    
      
      correlation_test
    
    
      
      brownian_motion_simulation,
      a MATLAB code which
      simulates Brownian motion in an M-dimensional region.
    
    
      
      cnoise,
      a MATLAB code which
      generates samples of noise obeying a 1/f^alpha power law,
      by Miroslav Stoyanov.
    
    
      
      colored_noise,
      a MATLAB code which
      generates samples of noise obeying a 1/f^alpha power law.
    
    
      
      pink_noise,
      a MATLAB code which
      computes a "pink noise" signal obeying a 1/f power law.
    
    
      
      random_walk_1d_simulation,
      a MATLAB code which
      simulates a random walk in a 1-dimensional region.
    
    
      
      sde,
      a MATLAB code which
      illustrates the properties of stochastic differential equations (SDE), and
      common algorithms for their analysis,
      by Desmond Higham;
    
    
      Reference:
    
    
      
        - 
          Petter Abrahamsen,
          A Review of Gaussian Random Fields and Correlation Functions,
          Norwegian Computing Center, 1997.
         
        - 
          Claude Dietrich, Garry Newsam,
          Fast and exact simulation of stationary Gaussian processes through
          the circulant embedding of the covariance matrix,
          SIAM Journal on Scientific Computing,
          Volume 18, Number 4, pages 1088-1107, July 1997.
         
      
    
    
      Source Code:
    
    
      
        - 
          correlation_besselj.m,
          evaluates the Bessel J correlation function.
        
 
        - 
          correlation_besselk.m,
          evaluates the Bessel K correlation function.
        
 
        - 
          correlation_brownian.m,
          evaluates the Brownian correlation function K(s,t).
        
 
        - 
          correlation_brownian_display.m,
          displays four "slices" of the Brownian correlation function K(s,t).
          Included for comparison only.
        
 
        - 
          correlation_circular.m,
          evaluates the circular correlation function.
        
 
        - 
          correlation_constant.m,
          evaluates the constant correlation function.
        
 
        - 
          correlation_cubic.m,
          evaluates the cubic correlation function.
        
 
        - 
          correlation_damped_cosine.m,
          evaluates the exponentially damped cosine correlation function.
        
 
        - 
          correlation_damped_sine.m,
          evaluates the damped sine correlation function.
        
 
        - 
          correlation_exponential.m,
          evaluates the exponential correlation function.
        
 
        - 
          correlation_gaussian.m,
          evaluates the gaussian correlation function.
        
 
        - 
          correlation_hole.m,
          evaluates the hole correlation function.
        
 
        - 
          correlation_linear.m,
          evaluates the linear correlation function.
        
 
        - 
          correlation_matern.m,
          evaluates the Matern correlation function.
        
 
        - 
          correlation_pentaspherical.m,
          evaluates the pentaspherical correlation function.
        
 
        - 
          correlation_power.m,
          evaluates the power correlation function.
        
 
        - 
          correlation_rational_quadratic.m,
          evaluates the rational quadratic correlation function.
        
 
        - 
          correlation_spherical.m,
          evaluates the spherical correlation function.
        
 
        - 
          correlation_to_covariance.m,
          converts a correlation matrix to a covariance matrix.
        
 
        - 
          correlation_white_noise.m,
          evaluates the white noise function.
        
 
        - 
          covariance_to_correlation.m,
          converts a covariance matrix to a correlation matrix.
        
 
        - 
          minij.m,
          computes the matrix whose entries are A(i,j) = min(i,j).
        
 
        - 
          r8mat_is_symmetric.m,
          checks that an R8MAT is symmetric.
        
 
        - 
          r8mat_print.m,
          prints an R8MAT.
        
 
        - 
          r8mat_print_some.m,
          prints some of an R8MAT.
        
 
        - 
          r8vec_print.m,
          prints an R8VEC.
        
 
        - 
          sample_paths_cholesky.m,
          computes sample paths of data with a given stationary correlation function,
          using the Cholesky factorization of the symmetric correlation matrix.
        
 
        - 
          sample_paths_eigen.m,
          computes sample paths of data with a given stationary correlation function,
          using the eigen decomposition of the symmetric correlation matrix.
        
 
        - 
          sample_paths_fft.m,
          computes sample paths of data with a given stationary correlation function,
          embedding the symmetric correlation matrix (which is actually Toeplitz)
          into a circulant matrix and then using fft techniques for fast factorization and
          multiplication.
        
 
        - 
          sample_paths2_cholesky.m,
          computes sample paths of data with a given nonstationary correlation function,
          using the Cholesky factorization of the symmetric correlation matrix.
        
 
        - 
          sample_paths2_eigen.m,
          computes sample paths of data with a given nonstationary correlation
          function, using the eigen decomposition of the symmetric correlation
          matrix.
        
 
      
    
    
    
      Last modified on 22 December 2018.