Time-Varying IIR Notch Filter with Reduced Transient Response Based on the Bézier Curve Pole Radius Variability

In this paper a concept of the second order digital infinite impulse response narrow band-reject filter with reduced transient response is proposed. In order to suppress the transient response of the considered infinite impulse response (IIR) notch filter its pole radius is temporarily varied in time using the Bézier parametric curve. Computer simulations verifying the effectiveness of the proposed pole-radius-varying notch filter are presented and compared to the performance of the traditional time-invariant filter using ECG signals distorted by unwanted powerline interference.


Introduction
Estimation, detection and filtering of narrowband signals in the presence of unwanted noise represent some of the important applications of signal processing techniques.In most of these applications it is often desired to suppress narrowband signals while leaving the broad band energy without changes.This can be achieved by passing the signals through a band reject filter whose notches are centered on the narrowband signals.Typical application areas include for example biomedical engineering and communications [1,2].Removing powerline interferences from ECG, EEG, and EMG recordings [3], filtering of humming GSM mobile telephone noise [4], and estimation of power system frequency [5] are specific examples of using notch filters.The design procedure of notch filters is usually a difficult task, particularly when the signals on a very narrow frequency band must be suppressed and those in the immediate neighborhood should be maintained without distortions.From the measurement point of view one of the most important problems of the signal processing path is the transient response of filters.The duration of the transient state depends mainly on the filter order and the filter selectivity [6].Long-lasting transients cause huge problems, particularly when short-time signals are filtered or when the initial phase of a processed signal is of great importance [7][8][9].In such cases a useful signal can be considerably distorted due to the presence of the filter transient response or the signal can be entirely lost in the transient.In many measurement-signal processing systems it is required to use notch filters which possess at the same time a very selective magnitude response and a short duration of the transient response.In the design of filters, however, the selective magnitude response and the transient response of short duration are design specifications which are contradictory to each other and, therefore, are very difficult to tune in a simultaneous way.
The trade off between the duration of the transient response and the selectivity of notch filters has been examined in a few works.In [10,11] the authors introduce non-zero initial conditions to the output of notch filters.As a result, the transient response of these filters is considerably suppressed.On the other hand, in [12], the notch filters with a time-varying quality factor and time-varying pole radius are proposed.The proposed time-varying notch filters are characterized by exponential variability of their parameters.By introducing time-varying parameters to the filter structure the authors attain a significant reduction of the duration of the transient response of notch filters.The results they obtained clearly show that the proposed methods are effective at filtering ECG signals.
In this paper, the second order digital infinite impulse response notch filter with reduced transient response is proposed.In order to suppress the transient response of the considered infinite impulse response (IIR) notch filter its pole radius is temporarily varied in time using the Bézier parametric curve.Computer simulations verifying the effectiveness of the proposed strategy clearly show that the Bézier curve is definitely more effective in reducing the duration of the transient response if compared to previously used exponential functions [12,13].The rest of this paper is organized as follows: in Section 2, digital IIR notch filters are discussed in more detail.The idea of the IIR notch filter with a time-varying pole radius is presented in Section 3. In Section 4, examples of using the proposed pole-radius-varying notch filter to filtering ECG signals distorted by powerline interference are provided.Finally, some concluding remarks are given in Section 5.

Digital IIR Notch Filter Specification
The magnitude response of ideal IIR filter can be written as: where ω = 2π f f s is the normalized frequency, f s is the sampling frequency, and ω 0 is the notch frequency.The notch effect of the IIR filter can be obtained by placing a pair of complex conjugate zeros at e ±jω 0 .The frequency response in the passband is close to unity by placing a pair of conjugate poles at re ±jω 0 .The value of r must be positive and less than unity.The transfer function of the second order IIR notch filter can be written as: where K 0 is the gain factor of the filter, ω 0 = 2π f 0 f s , f 0 is the frequency that has to be removed from a signal, and r is the radius of a pair of complex conjugate poles placed at the angle ω 0 , the same angle as the zeros of the designed filter.In this design, the bandwidth BW of the filter can be controlled through the value of r, being narrower as the pole radius goes closer to the unit circle.The Equation ( 2) can be rewritten in the following form: (3) The bandwidth of the obtained notch filter can be calculated using following equation: To improve the selectivity of the presented filter structure, the pole radius r needs to be as close to unity as possible.On the other hand, the settling time of the filter depends on the bandwidth as presented in [13].The settling time considered in this paper should be interpreted as the time it takes for y(n) − y f to fall below 2% of its peak value, where y(n) is the filter response at time n and y f is the filter steady-state response.The dependence of the transient duration on the pole radius r is given by the following equation: where n is the time index, A and B are constants, δ(n) is the Kronecker delta, and φ is the resultant phase.The first and the second term of Equation ( 5) correspond to the transient response [13].Due to the Kronecker delta δ(n), the first term only affects the first sample of the output signal.When the pole radius is closer to unity the component r n in the second term of Equation ( 5) causes a longer settling time, and therefore a longer transient response.The last term of Equation ( 5) contains only the filtered useful signal.As one can see, the value of the pole radius r of the considered second order IIR notch filter controls the duration of the settling time and thus the duration of the transient state.
In Table 1 settling times and rejection bandwidths of the second order IIR notch filter with f 0 = 50 Hz and f s = 500 Hz are presented.Both parameters are calculated for various values of the pole radius.
As one can see, the closer the pole radius approaches the unit circle, the higher the selectivity of the filter, and the longer the settling time of the output signal.

Time-Varying Pole Radius of the Filter
In order to suppress the transient response of the considered second order IIR notch filter it was assumed that the value of the pole radius r is temporarily varied in time.The proposed method gives the possibility to maintain the frequency specification and, at the same time, to improve the time-domain behaviour of the filter.The main assumption of the proposed idea is to change the pole radius from some set value to a value that is very close to unity.The proposed method allows us to obtain the notch filter with both a suppressed transient response and a narrow bandwidth.The transfer function of the second time-varying IIR notch filter can be expressed in the discrete time domain by the following difference equation: where y(n) and x(n) are the filter output and the input signal, respectively.The coefficient b In order to control the time variation of the pole radius r(n) the 3rd order Bézier curve is used.We have used the Bézier curve because this kind of function can be easily and freely shaped by means of predefined control points.Thanks to the Bézier curve we are able to generate the function that changes the pole radius in a more flexible manner if compared to the exponential function.The proposed parametric curve can be expressed in the following form: where the Cartesian coordinates of the Bézier curve control points are given as: B 1 = (x 1 , y 1 ), B 2 = (x 2 , y 2 ), B 3 = (x 3 , y 3 ), B 4 = (x 4 , y 4 ).The control points B 1 and B 4 determines respectively the starting and the ending point of the considered curve.The control points B 2 and B 3 deliver directional information.The distance between these control points specifies how the parametric curve moves towards the point B 2 before turning towards point B 3 .The coordinates of point B 1 includes the starting point of the time-varying formula x 1 = 0 and the starting pole radius y 1 = r start .On the other hand, the coordinates of B 4 determine the length of the variability time horizon x 4 = M and the final value of the pole radius y 4 = r f inal .In order to find the coordinates of the control points B 2 and B 3 the simulated annealing algorithm is used.The main aim of the annealing algorithm is to find B 2 and B 3 whose coordinates minimize the mean square error defined as: where K is the duration of the input signal, y(n) is the output of the signal, and s(n) is the clean original signal.Equation ( 7) can be reformulated to the following form: To find the values of the function B x = F B y (k) at query points for each sample of the filter transient response the interpolation procedure has been used.If the value of x 1 is equal to unity, the variation of the filter pole radius starts at the beginning of the filtering process.The coordinate x 4 = M should be interpreted as the time horizon of the pole radius variability.In Figure 1 the Béizer parametric curve that illustrates the variability of the pole radius of the considered notch filter is presented.In this figure all the control points are also indicated.The values of r f inal depend on the notch filter frequency specification.In this paper it is assumed that the value of r f inal is equal to 0.995.Such a value of the pole radius assures the bandwidth BW = 0.7957 Hz in the time-invariant case (for n > M).The notch frequency of the proposed filter is set to f 0 = 50 Hz and the sampling frequency is f s = 500 Hz.

Starting Pole Radius
In this subsection, a method for selecting the value of r start is proposed.In order to select the starting value of the filter pole radius the mean square error for the time-invariant IIR notch filter with various pole radii has been calculated using the following formula: where K is the duration of the input signal and y(n) is the output of the filter.The useful signal s(n) used in the procedure for determining the value of the starting pole radius is equal to zero.Therefore, this signal has been omitted in Equation (10).In the considered procedure the 50 Hz sine wave signal is used as an input signal.The values of MSE ti (r) have been determined based on filtering the notch frequency sinusoidal signal using filters with pole radii from 0.01 to 0.999.The relationship between MSE ti (r) and the value of the pole radius is presented in Figure 2. As one can notice, MSE ti (r) grows rapidly for r ∈ (0.9, 1).In order to find a strategic value of the pole radius the second derivative of MSE ti (r) has been used.For this purpose a function that approximates the obtained MSE ti (r) has been derived.The proposed function is a sum of three exponential base functions, and has the following form: where a = 0.02678, b = 928.9,c = 25.43,d = 0.0005132, e = 886.1,f = 61.95,g = 0.0008081, h = 1230, and i = 402.6.The second derivative of f (r) given by Equation ( 11) can be written as: In Figure 3 the second derivative of f (r) on the interval between r = 0.1 and r = 0.999 is depicted.The value of r start has been chosen as the pole radius for which the function given by Equation ( 12) approaches the local minimum.All important parameters of the proposed notch filter with time-varying pole radius are presented in Table 2.  (M,r f inal )

Quality Indices of Filtering
For the purpose of the qualitative evaluation of the presented filtering algorithm, the following performance indices were taken into account: • cross-correlation coefficient related to the original and filtered signal • percentage root mean square difference • mean square error defined by Equation ( 8).
In the above defined indices, K is the number of signal samples of the filter input signal under consideration, x(n) is the input signal to be filtered, y(n) is the filter output signal, and s(n) denotes the original input signal without disturbances.

Results
Computer simulations of the proposed second order notch IIR filter with time-varying pole radius have been made using the Mathworks Matlab 2018b.The considered notch filter with reduced transient response has been tested using ECG signals uploaded from the MIT-BIH database (Massachusetts Institute of Technology-Beth Israel Hospital).The proposed notch filter with time-varying pole radius has been used to remove the 50 Hz powerline interference from above mentioned ECG signals.
The sampling rate of the processed signal was equal to 500 Hz.

ECG Filtering
In the first step, the evaluation and quantitative comparison of the performance of ECG denoising processes for three various ECG signals were carried out.The results are presented in Table 3.For each signal four simulations have been done.The ECGs start at a different signal feature point in each simulation.The main aim of the proposed filtering algorithm is to work out the denoised ECG signal as fast as possible.The portion of the ECG signal lost on the transient response may impede appropriate measures.As one can notice, the proposed IIR notch filter with time-varying pole radius outperformed the traditional time-invariant filter structure in all considered cases.The value of index SNR imp for the proposed time-varying filter was greater for each simulation than in the time-invariant filter case.Moreover, the values of the cross-correlation coefficient ρ, percentage root mean square difference index, and mean square error index show that the proposed parameter-varying notch filter is definitely better if compared to the traditional filter with time-invariant pole radius.In Figures 4-6 the results of simulations are presented.

Bézier Function vs. Exponential Function
In the present subsection a comparison between the pole radius variation procedures based on Bézier parametric curve and exponential function is presented.The exponential function of the pole radius proposed in [12] is defined in the following form: where v denotes the exponential variation of r(n).In the first phase of the comparative analysis all the filters are tested using the 50 Hz notch frequency sinusoidal signal.Table 4 presents the comparison of the efficiency indices of the time-invariant notch filter and time-varying filters based on the Bézier parametric curve and exponential function.In the second phase of the comparative analysis all the considered filters are tested using the ECG signal distorted by the 50 Hz powerline interference.In Figures 9 and 10 the results of filtering are presented.As one can notice, the proposed notch filter based on the Bézier parametric curve is characterized by a much shorter transient response if compared to the filter based on the exponential pole radius variability.The advantages of the filter based on the Bézier curve are also reflected in all quality indices listed in Table 5.

Signal to Noise Ratio Analysis
In this subsection the influence of the signal to noise ratio with regard to the filtering efficiency is analyzed.During the tests the ECG signal was distorted by the 50 Hz powerline interference of various strengths.The signal to noise ratio (SNR) is defined as follows: where N denotes the signal length, x(i) is the input noised signal, and d(i) denotes the sinusoidal interference given by the following equation: where A is the ampliude of the intereference, ω denotes the frequency of the interference, and φ is the phase shift.In Table 6 the values of the mean square error for all tested SNRs are presented.Small value of the MSE means that the notch filter output y(n) is close to the original ECG signal s(n).8 presents cross-correlation coefficients for tested cases.The closer the ρ index is to unity, the stronger the correlation between the filter output signal and the original ECG signal.The filter based on Bézier curve pole radius variability achieves the highest values of the cross-correlation coefficient if compared to the traditional time-invariant filter and the time-varying filter based on exponential function proposed in [12].

Conclusions
In the paper, a concept of the second order time-varying IIR notch filter with reduced transient response based on the Bézier curve pole radius variability is presented.Thanks to the Bézier curve we are able to generate the function that changes the pole radius in a more flexible manner if compared to the exponential function.The proposed filtering algorithm is able to suppress the transient response much better than the traditional time-invariant filter and the filter based on the exponential pole radius variability.The proposed filter with suppressed transient response is able to process input signals faster than traditional solutions.As an example, the proposed notch filter has been successfully used to suppress the powerline interference from ECG signals.The performance of the considered filter structure has been evaluated using four different indices.Future works will be devoted to the implementation of the proposed filter structure.For example we are going to use the concept of coupled form second order sections [16][17][18] in our analysis and implementation works, in particular in case of using short word-length fixed-point binary arithmetic.

Figure 1 .
Figure 1.The Béizer curve and control points for the pole radius variability.

Figure 2 .
Figure 2. Mean square error with various filter pole radius.

Figure 3 .
Figure 3.The second derivative of the approximation function f (r).

Figure 4 .
Figure 4. Comparison between time-invariant infinite impulse response (IIR) notch filter and the proposed time-varying filter.Testing signal ECG 1 starts at various featured points.

Figure 5 .
Figure 5.Comparison between time-invariant IIR notch filter and the proposed time-varying filter.Testing signal ECG 2 starts at various featured points.

Figure 6 .
Figure 6.Comparison between time-invariant IIR notch filter and the proposed time-varying filter.Testing signal ECG 3 starts at various featured points.

Figures 7 and 8
present output signals of the considered filters.

Table 4 .Figure 7 .
Figure 7.Comparison of the time-invariant IIR filter and the proposed time-varying filter based on Bézier curve.

Figure 8 .
Figure 8.Comparison of the time-varying filters based on the Bézier parametric curve and exponential function.

Table 5 .Figure 9 .
Figure 9.Comparison of the time-invariant IIR filter and the proposed time-varying filter based on Bézier curve.

Figure 10 .
Figure 10.Comparison of the time-varying filters based on the Bézier parametric curve and exponential function.

Table 1 .
Settling time and bandwidth in the function of the pole radius.

Table 2 .
Parameters of the proposed notch filter with time-varying pole radius.

Table 3 .
Results of numerical experiments for various ECG signals.

Table 6 .
Comparison of the MSE for the time-invariant notch filter and time-varying filters based on the Bézier parametric curve and exponential function for various values of the signal to noise ratio (SNR).
In Table7values of the percentage root mean square difference for all tested SNRs are presented.

Table 7 .
Comparison of the percentage root mean square difference for the time-invariant notch filter and time-varying filters based on the Bézier parametric curve and exponential function for various values of the SNR.

Table 8 .
Comparison of the ρ index for the time-invariant notch filter and time-varying filters based on the Bézier parametric curve and exponential function for various values of the SNR.

Table 9
presents the SNR improvement indices for all cases.The SNR improvement index can be interpreted as a comparison of the level of a desired signal and the background noise.A larger value of the SNR i implies a smaller level of the noise.

Table 9 .
Comparison of the SNR improvement index for the time-invariant notch filter and time-varying filters based on the Bézier parametric curve and exponential function for various values of the SNR.