mvdetrend

Multivariate polynomial detrend of time series data

Syntax

   [Y,P,p,x] = mvdetrend(X,pdeg,x)

Arguments

See also Common variable names and data structures.

input

   X          multi-trial time series data
   pdeg       vector of polynomial degrees (default: 1 = linear detrend)
   x          vector of polynomial evaluation points (default: evenly spaced)

output

   Y          detrended time series
   P          polynomial fit
   p          polynomial coefficients (cell array)
   x          normalised evaluation points

Description

Multivariate polynomial detrend of time series data in X, which may be multi-trial. Adapted from Matlab polyfit and polyval. Polynomial degrees pdeg are supplied as a scalar (applied to each time series) or as a vector matching the number of variables; the default is a linear detrend. A vector x of points at which the polynomials are evaluated may be supplied; the default is evenly spaced (i.e. at each time step).

The de-trended series are returned in Y, the polynomial fits in P, the polynomial coefficients in the cell array p and the normalised evaluation points in x. Note: This routine effectively demeans as well.

See also

polyfit | polyval