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}$: Pectoralis major sample

For comparison, I provide a figure of another muscle's (Deltoid) signal , without the heart interference:

Deltoid sample 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.

  • $\begingroup$ 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. $\endgroup$
    – Jason R
    Mar 23 '15 at 18:31
  • $\begingroup$ @JasonR: I edited the question, hope it is clearer. $\endgroup$ Mar 23 '15 at 19:02
  • $\begingroup$ Could you add a FFT plot of your signals (pectoralis and deltoids), just to back up what andrew said about highpass filtering ? $\endgroup$
    – Loufylouf
    Mar 24 '15 at 9:35
  • $\begingroup$ @Loufylouf: I could certainly do that, but what exactly do you mean by FFT plot? A frequency spectrum? $\endgroup$ Mar 24 '15 at 17:00
  • $\begingroup$ Yes exactly. Don't forget to put the frequencies as x values. $\endgroup$
    – Loufylouf
    Mar 24 '15 at 17:04

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


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


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);

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

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])

subplot(2,1,1);plot(x);title('original samples')
subplot(2,1,2);plot(x_hpf);title('filtered samples')

signal fft samples


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 or wavelet-ICA to remove the ECG artefact. In these methods you do not need multi-channel signal. HPF is a simple method that you can use, 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 from your original signal.

Here is an example: https://books.google.com/books?hl=en&lr=&id=IzgxCgAAQBAJ&oi=fnd&pg=PA91&ots=ocvj368Gm3&sig=hCEMFXZMwo9mFRoGPAmH77k8b-4#v=onepage&q&f=false

  • $\begingroup$ 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. $\endgroup$
    – sansuiso
    Apr 10 '15 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.