| filters.coeff | R Documentation |
signal::butter() functionImplements notch, low-pass, high-pass, band-pass, and band-stop filters with desired frequency ranges and Butterworth filter order.
filters.coeff(
fs = 256,
notch = c(49, 51),
notch.order = 2,
lowpass = 30,
lowpass.order = 4,
highpass = 1,
highpass.order = 4,
bandpass = c(0.5, 40),
bandpass.order = 4,
bandstop = c(0.5, 40),
bandstop.order = 4
)
fs |
Sampling rate. |
notch |
Vector of two frequencies for notch filter. |
notch.order |
Notch filter order. |
lowpass |
Low-pass filter frequency. |
lowpass.order |
Low-pass filter order. |
highpass |
High-pass filter frequency. |
highpass.order |
High-pass filter order. |
bandpass |
Vector of two frequencies for band-pass filter. |
bandpass.order |
Band-pass filter order. |
bandstop |
Vector of two frequencies for band-stop filter. |
bandstop.order |
Band-stop filter order. |
List with parameters of individual filters.
file <- system.file("extdata", "EEG.edf", package = "MatchingPursuit")
out <- read.edf.signals(file, resampling = FALSE)
signal <- out$signals
sampling.rate <- out$sampling.rate
fc <- filters.coeff(
fs = sampling.rate,
notch = c(49, 51),
lowpass = 40,
highpass = 1,
bandpass = c(0.5, 40),
bandstop = c(10, 50)
)
print(fc)
signal::freqz(fc$notch, Fs = sampling.rate)
signal::freqz(fc$lowpass, Fs = sampling.rate)
signal::freqz(fc$highpass, Fs = sampling.rate)
signal::freqz(fc$bandpass, Fs = sampling.rate)
signal::freqz(fc$bandstop, Fs = sampling.rate)
plot(signal[, 1], type = "l", panel.first = grid())
signal.filt <- signal
for (m in 1:ncol(signal)) {
signal.filt[, m] = signal::filtfilt(fc$notch, signal.filt[, m]); # 50Hz notch filter
signal.filt[, m] = signal::filtfilt(fc$lowpass, signal.filt[, m]); # Low pass IIR Butterworth
signal.filt[, m] = signal::filtfilt(fc$highpass, signal.filt[, m]); # High pass IIR Butterwoth
}
plot(signal.filt[, 1], type = "l", panel.first = grid())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.