A method and apparatus for filtering an electromyogram (EMG) signal from a
raw signal which includes a contribution from an electrocardiogram (EKG)
signal is disclosed. The method includes the steps of estimating an
attribute (such as a Fourier transform) of both the EMG contribution to
the raw signal and the EKG contribution to the raw signal and, dependent
on both frequency spectrums, determining an EMG window in a frequency
range and obtaining the EMG signal by passing it through a filter defined
by the frequency range. The method is particularly used when monitoring a
multi-channel electrical recording from a plurality of electrodes
attached to a patient's diaphragm.