Remove the DC bias

Share:

Description

Adds a constant to all samples in the EMG to move the baseline noise mean in the presence of DC-offset or DC-bias.

Usage

1
dcbiasremoval(data, channel, baseline, data.name)

Arguments

data

an ‘emg’ object.

channel

in case of multi-channel data, channel is the specific channel to be considered by the procedure. Possible values: a character vector specifying the name of the channel to be considered (case sensitive) or a numeric value specifying the channel to be considered (number of column in data).

baseline

constant to be substracted to the EMG signal. If not provided, this values is set so the resulting EMG has and overall mean of 0.

data.name

a string specifying the name of the variable which will appears on the plots. If empty or not provided is taken from the object given as data.

Value

An ‘emg’ object.

Author(s)

J.E. Macias-Diaz, J.A. Guerrero jaguerrero@correo.uaa.mx

See Also

See also emg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# change graphical parameters to show multiple plots
op <- par(mfrow = c(2, 1))

# Creates a random vector to simulate a baseline noise with a DC-offset
x <- rnorm(1000, 1, 1)
emg1 <- emg(x, samplingrate = 1000, units = "mV", data.name = "")
plot(emg1, main = "Simulated EMG with a DC-offset")
abline(h = mean(emg1$values), col = "red", lwd = 2)  # Show the position of the overall mean

# Remove the baseline noise mean
emg2 <- dcbiasremoval(emg1)
plot(emg2, main = "Simulated EMG with an overall zero mean")
abline(h = mean(emg2$values), col = "red", lwd = 2)  # Show the position of the overall mean

# reset graphical parameters
par(op)