Skip to content

SincResample

  SincResample resamples signals to arbitrary lengths/frequencies and can
  timeshift them.

  SincResample can be faster than INTERP or RESAMPLE when X contains many
  relatively short data columns.


  Example:
  [Y, FOUT]=SincResample(X, NPOINTS, FIN, SHIFT, MODE)

  X is a vector or M x N  matrix where each column represents a signal.
  NPOINTS is the number of points required in each column after
  resampling.
  FIN (if supplied) is the sampling rate in X (default 1 samples/sec).
  SHIFT (if supplied) is the time (in seconds) to shift the points at which
  interpolation will be done (default 0). SHIFT should be between ±(1/Fin).
  SHIFT can be used to synchronize signals separated by up to ±(1/Fin)
  in time.
  MODE (if supplied) is a string:
            'sinc' to use a hamming-windowed sinc function (default)
            'lanczos' for a 3-lobed Lanczos function

  Y is the resulting M x NPOINTS matrix formed by resampling. The time
  of the first sample in each column of Y is shifted by SHIFT seconds
  relative to those in X.
  FOUT is the effective sample rate for output Y (normalised to FIN=1 if
  FIN is not supplied on input).

  If X is a bandlimited (filtered) signal containing components at
  DC - 0.5Fs where Fs is the sample rate, SincResample will return
  the signal that would have been seen with a higher sampling rate
  (and the same filter settings). The algorithm depends on the fact that
  the bandlimited signal is completely defined when sampling at Fs.

  SincResample returns the data convolved with a set of  time-shifted
  windowed sinc functions, one for each of the samples [1..size(x,1)]
  in the input signal. End-effects are reduced by adding a reflected 
  and mirrored copy of the data at the beginning and end of each column
  before resampling.

  Note that points at the end of Y (and/or beginning if SHIFT is negative)
  will be extrapolated beyond the boundaries of X.

  SincResample is a generalization of the method used in Blanche &
  Swindale (2006).

  See also e.g. interp & resample (in the Signal Processing Toolbox) and 
  the sinc online documentation.

  References:
  T.Blanche & N.V.Swindale (2006)
  Nyquist interpolation improves neuron yield in multiunit recordings
  Journal of Neuroscience Methods 155, 81-91 <a href="http://dx.doi.org/doi:10.1016/j.jneumeth.2005.12.031">LinkOut</a>

  also

  K. Turkowski, Filters for common resampling tasks <a href="http://www.worldserver.com/turk/computergraphics/ResamplingFilters.pdf">LinkOut</a>

  Toolboxes required: None

  Author: Malcolm Lidierth 07/06
  Copyright © King’s College London 2006-8

  Acknowledgements: Steve Alty for comments

  Revisions: 10.07  Argument checks tidied (ML)
             02.08  End-effect minimization now relects and mirrors data
                    instead of simply reflecting it. This improves the 
                    slopes at the end and reduces the behaviour described at
                    <a href="http://www.dsprelated.com/showmessage/79676/2.php">http://www.dsprelated.com/showmessage/79676/2.php</a>
                    (ML)
             02.08  Mode option added (ML)