Skip to content

filtfilthd

  FILTFILTHD Zero-phase digital filtering with dfilt objects.

  FILTFILLTHD provides zero phase filtering and accepts dfilt objects on
  input. A number of end-effect minimization methods are supported.

  Examples:
  x=FILTFILTHD(Hd, x)
  x=FILTFILTHD(Hd, x, method)
  where Hd is a dfilt object and x is the input data. If x is a matrix,
  each column will be filtered.

  ------------------------------------------------------------------------
  The filter states of Hd on entry to FILTFILTHD will be used at the
  beginning of each forward and each backward pass through the data. The 
  user should normally ensure that the initial states are zeroed before
  calling filtfilthd [e.g. using reset(Hd);]
  ------------------------------------------------------------------------

  x=FILTFILTHD(b, a, x) 
  x=FILTFILTHD(b, a, x, method)
            format is also supported.

  x=FILTFILTHD(...., IMPULSELENGTH)
    allows the impulse response length to be specified on input. 


  method is a string describing the end-effect correction technique:
    reflect:      data at the ends are reflected and mirrored as in
                    the MATLAB filtfilt function (default)
    predict:      data are extraploated using linear prediction
    spline/pchip: data are extrapolated using MATLAB's interp1 function
    none:         no internal end-effect correction is applied
                    (x may be pre-pended and appended with data externally)

  Each method has different merits/limitations. The most robust
  method is reflect.

  The length of the padded data section at each end will be impzlength(Hd)
  points, or with 'reflect', the minimum of impzlength(Hd) and the
  data length (this is different to filtfilt where the padding is only
  3 * the filter width). Using the longer padding reduces the need for any
  DC correction (see the filtfilt documentation).


  See also: dfilt, filtfilt, impzlength

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

  Revisions:
    07.11.07    nfact=len-1 (not len) when impulse response longer than
                            data
    11.11.07    Use x=f(x) for improved memory performance 
                            [instead of y=f(x)]
                Handles row vectors properly
    31.01.08    Allow impzlength to be specified on input