Detrend

This function detrends the data by fitting and subtracting a function from each channel. Either a linear (fitted and subtracted from each trial), exponential or double exponential function (fitted to average and subtracted from each trial) can be fitted.

Note that the Curve Fitting Toolbox is required to run either the exponential or the double exponential fit.

EEGLAB user interface

1. Select the type of function that will be fitted to the data: either linear, exponential or double (i.e. double exponential).

2. Enter the time range over which the detrend will be fitted and applied (in ms).

Scripts

Base function

EEG = tesa_detrend( EEG, detrend, timeWin ); Default use.

Pop function

EEG = pop_tesa_detrend( EEG ); Pop up window.

EEG = pop_tesa_detrend( EEG, detrend, timeWin ); Custom inputs.

Required inputs

Input

Description

Example

Default

EEG

EEGLAB EEG structure

EEG

-

detrend

String with type of detrend to perform; 'linear' or 'exponetial' or 'double'

'linear'

-

timeWin

Vector setting time window for detrending in ms. [start, end]

[11,500]

-

Outputs

Output

Description

EEG

EEGLAB EEG structure

Examples

EEG = pop_tesa_detrend( EEG, 'linear', [11,500]); Linear detrend.

EEG = pop_tesa_detrend( EEG, 'exponential', [11,500]); Exponential detrend.

EEG = pop_tesa_detrend( EEG, 'double', [11,500]); Double exponential detrend.

Last updated