PIVMat Function Reference<< Prev | Next >> 
corrf
Spatial correlation function and integral scale of a scalar field

Description
COR = corrf(F, DIM) returns the correlation function and the integral 
scale of the scalar field F along the dimension DIM (with DIM=1, 2, 
or 'x','y', for correlation along the 'X' or 'Y' direction). If F is an 
array of scalar fields, COR returns the average of the correlation 
functions of each field. 
 
For DIM='x', the correlation function is defined as 
   f(r) = < F(x,y) F(x+r,y) >, 
where <..> is the spatial average (over x and y) and ensemble average 
(over all the fields F). 
 
The integral scale of the correlation f(r) is defined as 
   IS = integral_(from r=0)_(to r=r_max) f(r) dr / f(0), 
where r_max is the maximum separation r. However, if the correlation 
f(r) does not decrease enough down to 0, the integral does not converge 
and IS is ill defined. It is therefore necessary to introduction a 
truncation scale in the integral. This truncation scale r_t is defined 
here as the scale at which f(r) decreases below a certain threshold. 
Five integral scales are computed by corrf, corresponding to the 
following thresholds: 
  IS0:  r_t is such that f(r_t) = 0 
  IS1:  r_t     ''       f(r_t) = 0.1*f(0) 
  IS2:  r_t     ''       f(r_t) = 0.2*f(0) 
  IS5:  r_t     ''       f(r_t) = 0.5*f(0) 
  ISinf:  r_t is given by the maximum separation r. 
 
COR is a structure which contains the following fields: 
  r:       separation length 
  f:       correlation function 
  unitr:   unit of separation length 
  unitf:   unit of correlation function 
  namef:   name of correlation function 
  isinf:   integral scale, computed as the integral of f up to the 
           maximum separation r. 
  r5:      scale at which f(r5)=0.5 (linearly interpolated) 
  is5:     integral scale, computed as the integral of f from 0 to r5 
  r2, is2, r1, is1, r0, is0 :  idem as r5, is5, for crossovers 
           at 0.2, 0.1 and 0 respectively 
 
COR = corrf(F, DIM, 'norm') normalizes the correlation function, so 
that f = 1 at r = 0. 
 
For a vector field V, corrf(vec2scal(V,'ux'),'x') and 
corrf(vec2scal(V,'uy'),'y') are the longitudinal correlation functions, 
and corrf(vec2scal(V,'ux'),'y') and corrf(vec2scal(V,'uy'),'x') are the 
transverse ones. 
 
Note that the convergence of the correlation function is not garanteed, 
especially at large separations r, for which very few data points are 
available to compute the correlation. 
 
If the crossover scales are not defined (i.e. if the correlation 
function does not decrease enough for large r), NaNs (not a number) 
are returned, and a warning is issued. Use corrf(...,'nowarning') to 
ignore these warnings. 
 
COR = corrf(..., 'verbose') also displays the computation in progress. 
 
If no output argument, the correlation function is plotted. 
 
Example
 
   v = loadvec('B00001.VEC'); 
   cor = corrf(vec2scal(v,'vx'),'x'); 
   plot(cor.r, cor.f, 'o-'); 
 
See Also
vec2scal, tempcorrf, statf, histf, vsf, specf. 
Published output in the Help browser 
   showdemo corrf 
 

 Previous: convert3dto2dfNext: docpivmat 

2005-2021 PIVMat Toolbox 4.20