# How to remove heart beats interference from pectoralis major electromyogram?

I am using electromyography to detect activity on pectoralis major, however I found an interference from heart beats that is affecting my posterior analysis. The sampling rate is 2000 Hz, and the time of sampling is 150 s. The main signal is the muscle activity as the arm moves (four major big masses in the figure, between $-2*10^{-4}$ and $1*10^{-4}$), and the interfercence can be seen in the figure below as pulses at constant rate on values between $-5*10^{-5}$ and $1*10^{-5}$: For comparison, I provide a figure of another muscle's (Deltoid) signal , without the heart interference: As I don't know much about filters, I would like to ask for advice on how to remove the heart interference from this signal. Specifically, some directions on how to do it on matlab or R.

I can not use methods to record simultaneously heart and pectoralis major signals, since all individuals have already been sampled.

I found some papers addressing this issue, but I'm not able to implement the suggested solutions. For example:

Removing ECG noise from surface EMG signals using adaptive filtering

A sample file with this data is available here.

• You might describe more clearly what the interference is and what your signal of interest is. It's not at all clear from the plot. – Jason R Mar 23 '15 at 18:31
• @JasonR: I edited the question, hope it is clearer. – Paulo MiraMor Mar 23 '15 at 19:02
• Could you add a FFT plot of your signals (pectoralis and deltoids), just to back up what andrew said about highpass filtering ? – Loufylouf Mar 24 '15 at 9:35
• @Loufylouf: I could certainly do that, but what exactly do you mean by FFT plot? A frequency spectrum? – Paulo MiraMor Mar 24 '15 at 17:00
• Yes exactly. Don't forget to put the frequencies as x values. – Loufylouf Mar 24 '15 at 17:04

One possible solution is to use a notch filter to remove frequencies commonly associated with heartbeats somewhere between 40 to 100 bpm or .66-1.66Hz

Or if you dont need any low frequencies just use a "highpass" filter where the cutoff is around 2Hz

These solutions assume that anything near the frequency of a heartbeat is unimportant

edit

using the sample data you provided I applied a simple HPF with a cutoff at 2Hz (technically it should be a little past 2, but you will see even as it is it reduced the low frequencies by several orders of magnitude). This may have removed a significant amount of the signal power but it didn't perfectly replicate the cardiac noise. I suppose you have to think the electrical pulse associated with contracting the separate chambers of the heart are much more complex than the resultant heartbeat. In any even here is the data and code, just so you can see the process

x = importdata('pectoralis Major sample.txt');
samples_per_second = 2000;
Ts = 1 / samples_per_second;

%filter design
cuttoff_hz = 2;
cutoff_freq = 2*pi*cuttoff_hz;
tau = 1 / (2*pi*cutoff_freq);
a = Ts / tau;

length_x = length(x);
nfft = 2^nextpow2(length_x);
X=fft(x,nfft)/length_x;

%single pole hpf
x_hpf = filter([1-a a-1],[1 a-1], x);
X_HPF = fft(x_hpf,nfft)/length_x;

figure(1);
subplot(2,2,1);plot(2*abs(X(1:nfft/2+1)));title('original fft')
subplot(2,2,2);plot(2*abs(X(1:nfft/2+1)));title('original fft')
xlim([0 5])
subplot(2,2,3);plot(2*abs(X_HPF(1:nfft/2+1)));title('filtered fft 0-5Hz')
subplot(2,2,4);plot(2*abs(X_HPF(1:nfft/2+1)));title('filtered fft 0-5Hz')
xlim([0 5])

figure(2);
subplot(2,1,1);plot(x);title('original samples')
subplot(2,1,2);plot(x_hpf);title('filtered samples')  If you have multiple recordings of the signal (captured from different electrodes) then you can apply Independent Component Analysis (ICA, http://en.wikipedia.org/wiki/Independent_component_analysis) to separate the cardiac component from your signal. (MATLAB toolboxes linked from the Wikipedia article).

For a comprehensive description and real world application of this technique (albeit on MEG data), please see: http://dx.doi.org/10.1109/TBME.2007.894968

If you don't have a reference ECG signal or multi-channel signals to use some methods such as adaptive filter, artificial neural network or ICA, it is possible to use wavelet transform with a nonlinear thresholding or wavelet-ICA to remove the ECG artefact (using Matlab). in these methods you do not need multi-channel signal. HPF is a simple method that you can use it, but it depends on your application. If you need EMG information in low frequencies then HPF is not recommended. The best cutoff frequency for HPF to remove ECG artifacts is 30 Hz which removes useful information below this frequency.

• Your answer is not really clear. For example, at the end you suggest to remove "useful" information below 30 Hz, but useful information should ideally be preserved, right? You could try to rephrase your answer by suggesting a step-by-step procedure to filter out the heart signal, this often helps in formulating clear answers. – sansuiso Apr 10 '15 at 10:55