corr2d
calculates the synchronous and asynchronous correlation
spectra between Mat1
and Mat1
(homo correlation)
or between Mat1
and Mat2
(hetero correlation).
1 2 3 4 
Mat1, Mat2 
Numeric matrix containing the data which will be correlated;
'spectral variable' by columns and 'perturbation variables'
by rows. For hetero correlations 
Ref1, Ref2 
Numeric vector containing a single spectrum, which will be
subtracted from 
Wave1, Wave2 
Numeric vector containing the spectral variable. Needs to be
specified if column names of 
Time 
Numeric vector containing the perturbation variables. If specified, 
Int 
Function specifying how the dataset will be interpolated to give

N 
Positive, nonzero integer specifying how many equally spaced
perturbation variables should be interpolated using 
Norm 
A number specifying how the correlation matrix should be normalized. 
scaling 
Positive real number used as exponent when scaling the dataset with its standard deviation. Defaults to 0 meaning no scaling. 0.5 (Pareto scaling) and 1 (Pearson scaling) are commonly used to enhance weak correlations relative to strong correlations. 
corenumber 
Positive, nonzero integer specifying how many CPU cores should be used for parallel fft computation. 
preview 
Logical: Should a 3D preview of the synchronous correlation
spectrum be drawn at the end? Uses 
corr2d
uses a parallel fast Fourier transformation
(fft
) to calculate the complex correlation matrix.
For parallelization the foreach
function is used.
Large input matrices (> 4000 columns) can lead to long calculation times
depending on the number of cores used. Also note that the resulting
matrix can become very large, adjust the RAM limit with
memory.limit
accordingly. For a detailed description
of the underlying math see references.
corr2D
returns a list of class "corr2d" containing the complex
correlation matrix ($FT
), the used reference spectra ($Ref1
,
$Ref2
), the spectral variables ($Wave1
, $Wave2
), the
(interpolated) perturbation variables ($Time
) and logical variable ($Het
)
indicating if homo (FALSE
) or hetero (TRUE
) correlation was done.
I. Noda (1993) <DOI:10.1366/0003702934067694>
I. Noda (2012) <DOI:10.1016/j.vibspec.2012.01.006>
For plotting of the resulting list containing the 2D correlation
spectra see plot_corr2d
and plot_corr2din3d
.
1 2 3 4 5  data(FuranMale, package = "corr2D")
twod < corr2d(FuranMale, Ref1 = FuranMale[1, ], corenumber = 1)
plot_corr2d(twod, xlab = expression(paste("relative Wavenumber" / cm^1)),
ylab = expression(paste("relative Wavenumber" / cm^1)))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.