Interpolate removed data

This function replaces removed data using interpolation. Either linear or cubic interpolation can be used. All data that has been previously removed will be interpolated. Note that either tesa_removedata or pop_tesa_removedata must be ran prior to this function.

EEGLAB interface

1. Choose the type of interpolation to perform on the data from the drop down menu.

Linear - performs a linear interpolation between the existing data points either side of the removed data.

Cubic - performs a cubic interpolation using Matlab's polyfit function. A cubic function is fitted on the data either side of the removed data indicated in 2.

2. Time window for fitting cubic. This determines how many milliseconds either side of the removed data are considered when fitting the cubic function. Default values are 20 ms. Note that at least two samples must be present in each window for fitting a cubic function (e.g. if the data are sampled at 1 kHz a 1 ms window will only have 1 sample, however if the data are sampled at 5 kHz a 1 ms window will have 5 samples).

Script

Base function

EEG = tesa_interpdata( EEG, interpolation ); Default use.

EEG = tesa_interpdata( EEG, interpolation, interpWin ); Custom input.

Pop function

EEG = pop_tesa_interpdata( EEG ); Pop up window

EEG = pop_tesa_interpdata( EEG, interpolation ); Default use.

EEG = pop_tesa_interpdata( EEG, interpolation, interpWin ); Custom input.

Required inputs

Inputs

Description

Example

Default

EEG

EEGLAB EEG structure

EEG

-

interpolation

(Required) String describing type of interpolation, either 'linear' or 'cubic'

'linear'

-

interpWin

(Optional) Vector with times before and after artifact window for fitting cubic function.

[20, 20]

[20,20]

Outputs

Outputs

Description

EEG

EEGLAB EEG structure

Examples

EEG = pop_tesa_interpdata( EEG, 'linear' ); replaces missing data with linear interpolation. Linear function is fitted on data point before and after missing data.

EEG = pop_tesa_interpdata( EEG, 'cubic', [50,50] ); replaces mising data with cubic interpolation. Cubic is fitted on data 50 ms before and 50 ms after missing data

Last updated