filterdata | R Documentation |
Filter data in a ctd
object.
filterdata(ctd_obj, filt)
ctd_obj |
object of class |
filt |
filter object recognized by the |
Filtering is done using the filtfilt
function in the gsignal
package, which minimizes filter startup transients by pre- and postpending
reflected pieces of the input signal, which are tapered to zero. Forward and
reverse filtering the signals corrects for phase distortion (not perfect in
practice).
A ctd
object containing the filtered data.
Geert van Boxtel, G.J.M.vanBoxtel@gmail.com
data(EEGdata)
fs <- fs(EEGdata)
nyq <- fs / 2
## 10 Hz low-pass (Butterworth; maximally flat)
but <- gsignal::butter(3, 10 / nyq)
lpd <- filterdata(EEGdata, but)
plot(lpd)
## 8-12 Hz low-pass filter
## note that selecting a subset of signal
filt <- gsignal::fir1(50, c(8, 12) / nyq, "pass")
alpha <- filterdata(selectdata(EEGdata, signals = 1:28), filt)
plot(alpha, ylim=c(-10,10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.