Skip to content

wvCorrelation

  wvCorrelation calculate correlations between waveforms

  Example:
  wvCorrelation(fhandle, PropName1, PropValue1....)
  wvCorrelation(channels, PropName1, PropValue1....)
        calculates the correlation(s) and plots them
  out=wvCorrelation(fhandle, PropName1, PropValue1....)
  out=wvCorrelation(channels, PropName1, PropValue1....)
        returns a sigTOOLResultData object

  where fhandle is a sigTOOL data view handle and channels is a sigTOOL
  channels cell array

  Valid property name/values are:
      Refs          The list of reference channels numbers
      Sources       The list of source channel numbers. If empty, the
                    autocorrelations of the channels listed in refs
                    will be calculated
      Start         The start time for the calculations (seconds)
      Stop          The end time for the calculations (seconds)
      MaximumLag    The largest postive lag for which correlation should be
                    returned. Correlations will be returned for all lags
                    between -MaxLag and MaxLag
      RemoveDC      A logical flag. If true, the mean of the data will be
                    subtracted before calculating the correlations.
      ScaleMode     Controls scaling of the result:
                        None        No scaling - the covariance is returned
                        Biased      Divided by N
                        Unbiased    Divided by N-(abs)lag
                        Coeff       Normalized to the range -1 to 1
                    N above represents the size of the data block.
                    This is maximally MaxBlockSize at described below.
      MaxBlockSize  An FFT based algorithm is used to calculate the
                    correlations. MaxBlockSize is the maximum length of
                    data used in each FFT. This defaults to 2^22. If the
                    length of data exceeds MaxBlockSize, multiple FFTs will
                    be done and the returned correlation will be the
                    simple average of these. The used block size will be
                    length(data)/M where M is 2, 4, 8 etc chosen to yield a
                    size less than MaxBlockize. Data points beyond M*block
                    size will be discarded.

  Correlations will be calculated only those channel pairs where the sample
  rate is equal and they are sampled synchronously. Multiplexed channels
  are not supported.

  Note that when ScaleMode is 'none', 'Biased' or 'Coeff' the result is
  biased: the correlations will fall towards zero as the lag approaches
  the length of the data (or of the data block).

  Data blocks will be zero padded to avoid wraparound in the FFT. 
  Additional padding is added to produce an integer power of 2 input
  size for the FFT.

  Note that, when multiple data blocks are used, blocks are treated
  independently and the correlations are simply averaged. Proper
  overlap-add is not used so no account is taken of the effects between
  data points at the end of block n and those at the beginning of block n+1.
  These effects should be small for block sizes>>number of lags.


  -------------------------------------------------------------------------
  Author: Malcolm Lidierth 09/07
  Copyright © The Author & King's College London 2007-
  -------------------------------------------------------------------------