4
$\begingroup$

I am having a problem in my current project where I need to measure different biological signals (like ECG) simultaneously.

As the instrumentation hardware is developed by different people over time, they are not identical to each other. All of them has different orders of low-pass and high-pass filters before their final amplification stage. These filters are mostly concentrated around the passband of [0.5-35] Hz. I want to compensate for the phase dispersion caused by those analog filters by designing my own digital filters. I have measured the transfer functions of those channels using chirp signals, to get an idea, please check the following figure. There might be small numerical errors in the calculation of the transfer function. Transfer function of Channel 1 Transfer function of Channel 2

Not only eliminating the phase dispersion in the individual channels but also compensating the different amount of delay of those channels is important so that I can analyze fully "synchronized" signals. So far, I have been trying to design an all-pass filter in Matlab using iirgrpdelay function. However, the created compensation filters are not satisfying. The reason for that might be the huge variation in group delay (see the first figure) between [1 15] Hz, the region I want to compensate. Increasing the order of the filter doesn't help since I mostly get the following error from Matlab:

Poorly conditioned Hessian matrix. Cannot accurately compute the optimization because either the approximation error is extremely small (try reducing the number of poles or zeros) or the filter specifications yield huge magnitude variations, such as mag=[1 1e9 0 0].

I don't want to leave the question this broad but I am asking for suggestions to design such compensation filters in the digital domain so that I can neutralize this phase dispersion and delay in the analog instrumentation.

$\endgroup$
2
  • $\begingroup$ Your first transfer function starts at -180o. Is this correct? Either your filter is inverting or there has been an inversion in the measurement setup. $\endgroup$
    – Ben
    Commented Jul 30, 2019 at 14:27
  • 1
    $\begingroup$ Thanks for the notice, it probably is an inverting amplifier. That should be taken into consideration as it is not a "real delay" in the sense of phase delay. Especially for single-lead ECG setup, we mostly ignore checking the polarity of the electrodes if the signal will be analyzed later on offline. $\endgroup$
    – falsterbo
    Commented Jul 31, 2019 at 7:24

1 Answer 1

5
$\begingroup$

It's often easier to design FIR filters for compensating group delay. At the same time they could also compensate the magnitude if necessary. The easiest method is to use a complex least squares method, which boils down to solving a system of linear equations for the filter coefficients.

The difficult part is to choose an appropriate bulk delay in the definition of the desired phase response. A good starting point is to choose the average delay to be close to half the filter length.

Take a look at this answer for an example of FIR group delay equalization.

You can use the Matlab/Octave function lslevin.m for designing FIR filters with prescribed magnitude and phase responses.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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