This function applies a bandpass filter to a signal. It first normalizes the high and low frequencies based on the Nyquist frequency, then creates a Butterworth filter using the `signal::butter` function, and finally applies the filter to the signal using `signal::filtfilt`.

bandpass(x, high, low, sRate, order = 5)

Arguments

x

A numeric vector representing the signal to be filtered.

high

The high cutoff frequency for the bandpass filter.

low

The low cutoff frequency for the bandpass filter.

sRate

The sampling rate of the signal.

order

The order of the Butterworth filter, defaulting to 5.

Value

A numeric vector representing the filtered signal.

References

If applicable, add references here.

See also

Examples

sample_signal <- sin(seq(0, 10, length.out = 1000))
filtered_signal <- bandpass(sample_signal, high = 0.3, low = 0.1, sRate = 100)