Abstract
Cardiovascular health and training success can be assessed using electrocardiogram (ECG) data. For over a quarter of a century, an individual’s resting heart rate is varying more. As a result, it has become the subject of inquiry and reveals the intricate relationship between the human body and its environment. The autonomic nervous system has impact on blood flow system based on the rate of heartbeats. However, heart rate variation (HRV) characteristics analysis throughout the time period has lack of physical activity information. In the presence of patient movement, ECG signal is suffering from hard artefacts. Time-varying HRV parameters can be derived from low-frequency (LF) and high-frequency (HF) domains of the correct frequency. However, sometimes it is critical to ensuring accurate detection of the R-peak position. The proposed ROIIR (reduced-order IIR) offers 8.8% improvement in peak-to-peak swing than earlier IIR filter. We present an advanced filtering algorithm that is used for R-peak detection.
1. Introduction
An individual’s heart is a muscular structure that pumps blood through the circulatory system, allowing them to live. If the heart fails, a person will die. Heart illness is the foremost basis of death amongst humans today. Many people die as a result of heart illness. An electrocardiogram (ECG) is a recording of the physical explanation of electrical performance during the heart sequence. In order to discover heartbeat problems, ECG is utilized to assess heartbeat’s rate and rhythm. Heart issues can be diagnosed early if they can be monitored by an ECG. Electrocardiogram (ECG) signal is a graphical depiction of cardiac commotion that can be used to identify heart illness.
Various waves, segments, and limited interludes make up the ECG signal. P, Q, R, S, and T are the five basic ECG waves. Information about cardiac disease can be gleaned from P-QRS-T wave patterns and the time interludes amongst crests. The QRS complex, the P and T waves, the QRS-Q wave, the R wave, and the S wave are all critical components in the ECG signal analysis [1]. Humanoid stress, crusade, ECG machine cable dislodgment, machine issue, and lead misplacement can all modify the electrode skin impedance, resulting in a noisy signal that can be hard for computer processing and difficult for a cardiologist to understand. The ECG data must therefore be filtered in order to detect and further process the heartbeat peak. Baseline drifts, power line interference, and ECG noise all contribute to ECG signal noise. Power line interference occurs at medium frequencies, and electromyography occurs at high frequencies; hence, baseline wander is a low-frequency filtering phenomenon. Filters are applied to eradicate these noises. When the noise in the ECG input signal is reduced using filters, the desired information can be extracted [2]. High-pass, low-pass, band-pass, band-stop, and all-pass filters are all used in ECG filtering. Filtering is based on the cut-off frequency; if we lower the cut-off frequency, then lowering the frequency will be allowed to pass through. The low and high frequencies are reduced by a band-stop filter, whereas the high and low frequencies are not affected by an all-pass filter. Filters are divided into two types: analogue and digital. Finite impulse response (FIR) filters and infinite impulse response (IIR) filters are once again two types of digital filters. FIR filters are outperformed by IIR filters in terms of speed and memory requirements. The IIR filter is a recursive filter centred on a sole linear filter, with the current output linked to the preceding input and output. There are less design parameters, less memory needs, and less computational complication in IIR digital filters compared with FIR digital filters [3]. Designing and implementing IIR filters are more versatile since there are fewer limitations. When compared with FIR filters, IIR filters have a smaller number of parameters but are more vulnerable to noise and have a shorter response time. From the analogue filter, a bilinear transformation is used to create the digital IIR filter. Digital filters with a limitless impulse retort are known as IIR filters.
Heart rate variability (HRV), or the temporal deviation between heartbeats, has been increasingly noteworthy in recent years. The precise identification of R-peaks and RR-intervals for physiological interpretation has become increasingly important [1]. Following the transfer of RR interludes into frequency domain moreover in certain frequency bands is known to be associated with activation of the sympathetic and parasympathetic nervous system and central nervous system [1]. Many motion artefacts, such as random or stochastic noise, cause the ECG to deform and the signal-to-noise ratio (SNR) to plummet, especially during physical activity [4–6]. ECG algorithms used in clinical practice are not intended for this determination and so demonstrate high false alarm degrees, resulting in inaccurate HRV measurements. In order to deal with motion artefacts, a number of filter approaches have been proposed. Finite impulse response (FIR) filters are commonly used in many algorithms. It is possible to obtain an undistorted ECG signal from this method because the FIR filter is combined with a delay that is equal to the essential numeral of the filter. A large number of filter coefficients are required by FIR filters to achieve the desired signal characteristics, resulting in a significant rise in the computational burden. Mobile applications, especially those that demand low battery consumption, limit the computer resources available; therefore, computational costs become increasingly significant. Because the FIR filter is bidirectional, we recommend employing a bidirectional infinite impulse response (IIR) filter. It is possible to achieve a great quality output with less filter constants and less computation time using the recursive IIR filter. The problem of familiarizing a phase shift can be avoided by smearing the filter bidirectional [7, 8]. Following the filtering step, we add an R-peak detector founded on an improved methodology to perceive R-peaks to overcome motion artefacts [9]. Extra plausibility checks are needed to evaluate whether the observed event is part of a genuine R-peak or an artefact. In the particular instance of mobile data, R-peak detection rates can be enhanced using these innovations.
2. ECG Dataset Details
A total of 18 ECG data were used to contrivance this investigation in the MATLAB surroundings. Each recording lasts for 30 minutes and 5556 seconds, but the time displayed below has been adjusted down to the next second to account for rounding errors. The heart rate is recorded in beats per minute across three R-R intervals [10]. Moreover, same database was applied in one of another research [11].
3. Existing Methodology
In research work [12], high-power noise in the ECG was reduced using an IIR Butterworth filter. This claim is backed up by the results of an IIR Butterworth low-pass filter, which demonstrate that the power of the filter signal is lower than that for the noise signal. Li et al. [6] developed an upgraded numeral coefficient IIR filter and associated with straight approaches of numeral coefficient. Low- and high-pass filters created by IIR can reduce both power frequency interference and baseline drift [13].
The Butterworth low-pass filter has a cut-off frequency of 100 Hz, which is used by Gaikwad and Chavan [14] to reduce noise from the ECG data. The result shows a reduction in noise of −18 dB. To eradicate power line noise from ECG signals, the discrete Fourier transform founded algorithm, IIR, FIR, Kalman wavelet, and in addition, advanced-order statistical filtering techniques were applied by Amiri et al. [15]. It has been determined that FIR filtering and IIR filtering improve SNR the most. Elliptic filtering and Butterworth Chebyshev type I, type II, and elliptic filtering were applied by Bhogeshwar and colleagues [16] to reduce noise from ECG signals. Once these algorithms applied to the MIT-BIH ECG database signals, the IIR elliptic filter is said to have increased SNR performance [17].
High-frequency disturbances whose order was experimentally selected were removed by Dhar et al. [17] using a Butterworth low-pass filter. To make the ECG file smaller, we compress the filtered signal using a stringent lossless approach. Das and Chakraborty [7] attempted to sifter ECG indications using FIR and IIR filters. Elliptic filter and Chebyshev type I IIR filters had the highest SNR values in 2 to 4 filter ranges, according to the results. If the filter order is amongst 12 and 14, then the SNR for Chebyshev type II is great [8, 18]. SNR fluctuations in the filter order have been discovered to lead to the selection of the correct filter for ECG filtering. Wavelet transforms can be combined with evolutionary algorithms for enhanced noise removal, according to Ref. [19, 20]. There are 10 ECG signals that were taken from the MIT-BIH arrhythmia record. A low-pass filter was designed by Saini et al. using IIR filters, for example, Butterworth, elliptic, and Chebyshev filters to reduce the electromyography noise [21]. In addition, FIR digital sifters are applied. Elliptic IIR strainer with Blackman of FIR filter demonstrated superior consequences in SNR besides power spectral density presentation metrics than the conventional FIR filter [22]. Consequently, to remove various sounds from ECG data, we developed a cascaded FIR/IIR filter [23, 24].
4. Validation of Existing Filter Designs
4.1. IIR Filter Design
Kumari and Singh [25] have designed the two-stage IIR filter using band-pass and band-stop filters. The performance of several techniques based on FIR and IIR filter designs has been examined by them. The collected speech signal is typically coarser and requires front-end filtering. The FIR/IIR filter is widely used. It was the goal of this publication to validate the previously published Kumari and Singh [25] IIR filter design for improving speech signals.
The IIR filter is designed in two stages as combination of the band-pass and band-stop filters. The transfer function of the two-stage IIR filter design is given as follows:
It is clear from Figure 1 that IIR filter can remove the noise at the front end for speech signal but need to carefully define the cut-off frequencies and also need improvement [10, 26].

4.2. Comparison of the Transfer Functions
The band-pass filters of the selected cut-off frequencies having transfer function, as an example, for ECG signal from 106 MIT-BIH data, are defined as follows:where h2 is the band-stop filter’s transfer function. A sample transfer function for ECG signal from 106 MIT-BIH data is as follows:
In the further sections of the manuscript, the performance of the proposed filter is evaluated using the transfer functions [27].
4.3. Results of the Optimum Reduced-Order Filter Proposal
This is observed via equations (2) and (3) above, the basic IIR filter entails a 16-order, advanced-order filter. To minimize the order of the transfer function, Min-Max optimization is projected in this study. The IIR filter’s numerator and denominator coefficient vectors [b1, a1] optimize Min-Max optimization. As seen in the sequential process for Min-Max optimization, transfer function coefficients are optimized consecutively. This IIR filter is termed as optimum reduced IIR (ORIIR).
4.4. Transfer Function Analysis of ORIIR
In this section, Table 1 represents the transfer functions aimed at several phases of the proposed lower mandate IIR filter strategy for ECG signals. As can be seen, our solution considerably reduces the filter order while also preserving the behaviour of the ECG signal, as beforehand mentioned. It is also seen that the IIR filter has a 16-order design, but after optimization, the reduced-order filter has a 2-order enterprise.
4.5. Design Parameters and Impacts
The FIR filter outperforms the IIR filter in terms of frequency stability. Since the zeroes in the FIR filter transfer function are fixed, this is the case. As a result, addressing the issue of IIR filter stability is a challenging task. Therefore, this manuscript is focused to analyse the stability performance.
The channel simulator’s input parameters are divided into two groups. The main benefit of this filter design is that it reduces compute delay and filter order. The stability of the best reduced-order filter for transfer functions is investigated. Filters are used to minimise the effects of ECG readings on the patient’s movement. In addition to filter stability, the step, impulse, and pole-zero responses are also being studied.
In this study, the evaluation of filter performance is based on the examination of transfer function (TF) stability and pole-zero plots.
Many digital filters have been designed to reduce external and internal noises. Because the digital filters are programmable, their characteristics can be modified easily, while the hardware remains the same. Digital filters can be reprogrammed to change their characteristics without needing to change the hardware. Digital filters appear to be more consistent over time than analogue filters.
4.5.1. Stability and Response Analysis
The outcomes of the filtered signal response are evaluated in this part using the IIR filter’s recommended design. An IIR filter is composed of a band-pass filter and a band-stop filter, and the best reduced-order filter is examined for stability and transfer properties. To eliminate noise aberrations, ECG readings are filtered. For filter stability testing, the step, impulse, and pole-zero responses are evaluated for the three filter architectures including Pan–Tompkins 32-order FIR, 60-order FIR filter, and the projected IIR filter with abridged order. Zero plots are used to measure the performance of filters based on the stability and poles of transfer functions. The amplitude besides frequency reactions of the recommended IIR filter strategy are compared first in this section.
The presentation of the FIR filter used in the Pan–Tompkins method is compared to our proposed optimum reduced IIR filter design architecture, which employs a 16th-order IIR filter. The suggested filter has a substantially higher and steadier response, allowing it to efficiently minimize signal noise.
(1) 60-Order FIR Filter Step Responses. This study looks at the effectiveness of a 60-order filter for a design with a cut-off frequency of Wn = 0.2 and band-pass ripples of 1.5 decibels (dB’s). A 60-order filter is used to filter at 50 Hz. A band-pass filter is also applied to ECG signals. The 60-order filter produced in this study has a transfer function of h notch, which stands for eighth-order filter [29].
The transfer function of Pan–Tompkins 32-order filter is as follows:
A mix between a band-pass and a band-stop filter, the IIR filter is a hybrid. The transfer functions for an ECG artefact reduction approach [13, 27]. It can be observed that the designed two-stage IIR filter has the transfer function of the order 16. The designed transfer function approximation used for the recent two-stage IIR filter is as follows:
Figure 2 compared the 32-order Pan–Tompkins filter, 60-order filter, and the two-stage IIR filter magnitude responses. It can be concluded from Figure 2 that the IIR filter with two stages the better magnitude responses [28]. The basic filter used by the standard Pan–Tompkins algorithm was of 32 orders. It has many ripples in magnitude response. It justifies the hardware complexity. The modified 60-order filter as used has the reduced magnitude [30]. The overall comparison justified the effectiveness of the proposed filter response. Nevertheless, it is also required to further minimise the filter order from 16.

(a)

(b)

(c)
Figure 3 represents the comparison of three stages of our proposed optimum abridged IIR filter design for magnitude response. It is clear from Figure 3 that abridged-order filter has less magnitude response and thus may lead to amplification but has better filter response. The frequency bands that the filter will pass or reject can be used to describe the magnitude response of the filter.

(a)

(b)

(c)
This is clearly observed from Figure 3 magnitude responses that the proposed reduced-order IIR filter has the slope, which is same as magnitude response reduces to around −2 dB to −12 dB for the frequency range of 0 to 1 normalized range, while this is clear from Figure 3(b) that simple digital IIR filter although having flat response but over’s the sharp cut-off in magnitude of around −40 dB at the 0.8 normalized range or (80%) frequency spectrum. Therefore, over the entire optimum reduced-order filter relatively has flat response. These data ranges are mentioned within the red colour rectangles in Figure 3.
4.5.2. Group Delay Response
“Group delay” is nothing more than the lag between an input burst and its amplitude envelope in an output burst. The term “group delay” refers to the time it takes for a signal’s envelope to travel through a filter. Figure 4 represents the comparison of the group delay responses. Figure 4(a) shows that the 60-order FIR filter has a nonlinear group delay and a varying response.

(a)

(b)

(c)
It can be clearly served from Figure 4 that optimum IIR reduced-order filter has the flat group delay response as compared to the 60-order FIR filters. A flat group delay filter’s main advantage is that binary digits related to distortions are reduced. This is due to the fact that the transmitted pulses’ harmonic components will all pass through the filter at the same time.
However, a magnitude response curve only conveys half the story. In addition, the phase response of filters must be considered. The phase response (the group delay response) impacts the transient response of filters [19]. Linear phase implies a flat group delay across a given bandwidth [8]. The flat group delay signifies that the filter follows the shape of the signal. In research work, Ref. [19] has presented the group delay lineation method. To justify the group delay response, the comparison of the group delay for band-pass, IIR filter, and optimum reduced-order IIR filters are evaluated. Figure 5 has presented the comparison of the group delay for IIR filter and the reduced-order IIR filter. It is clear that significant reduction is observed in the group delay by proposed optimum reduced-order IIR filter. There is a near-linear response. The genuine character of the ECG signal should be preserved better as a result of this.

The improvement in the group delay of the filter transfer functions is clearly observed from Table 2. The quantitative performance for Mean delay, Max delay, and Min delay is presented in Table 2. The delay for band-pass filter (BPF), IIR filter, and reduced-order IIR (ROIIR) is presented in the Table 2.
To further graphically present the GD response, the peak-to-peak group delay is plotted in Figure 6. The improvement in the PP-GD values of the group delay responses is clear from Figure 6.

4.5.3. Step Response of Filters
This section uses filter transfer functions to demonstrate the step response comparison for reduced-order filter design. In this study, this has proposed to optimise the IIR filter, the Min-Max optimization is applied across the coefficients of the IIR filters. The reduced-order IIR filter constructed as the transfer function of a second-order filter with step response is shown in Figure 7

(a)

(b)

(c)
The nonlinear impulse response comparisons of the filters are presented in Figure 8. The ECG signal is analysed using the fitter application in this publication. However, the filter can be applied to a variety of other indicators as well.

(a)

(b)

(c)
It is observed from impulse response comparison form Figure 8 that reduced-order filter has less peak amplitude than 60-order filter. Moreover, we have only two impulses and nonlinear responses.
(1) Significance of Impulse Response. ECG signals are usually of less amplitudes of around 1 or less. Thus, it has become essential to filter the noise at the front end of ECG signal processing since most of ECG processing is implemented using on board tiny hardware. Thus, it is good enough to design the reduced-order efficient ECG filters. Thus, a reduced-order filter is favoured since it provides a lower number of impulses in the response. Reduced impulses and magnitudes are required for a step reaction. The tabular magnitude comparison of the step response and comparison with validation of the Jain and Rathore 2021 [20] is given in Table 3.
It is clear from Table 3 that our projected ROIIR filter is better suited for the real-time implementation of the filter with less step magnitude. Peak-to-peak magnitudes for step responses for IIR filters are shown in Figure 9.

4.6. Stability-Based Analysis
In this section, the stability requirement for various designed transfer functions (TFs) was investigated. The poles and zeroes are plotted for evaluating the stability of the specified filter responses.
4.6.1. Stability Analysis
The pole-zero analysis is used to assess the stability of the 60-order filter, IIR filter, and proposed optimum reduced-order IIR filter’s designed transfer functions. Figure 10 depicts the filtered signal results and the corresponding pole zero graphs. The results of the noisy and artefact ECG channel CH-101 are compared. The ECG data help with the synthetic random noise, and the results in each row correlate with the IIR and reduced-order filters, respectively. The position of the transfer functions’ poles and zeros in the z plane with respect to the unit circle determines the filter’s stability. The poles must be on the left side of the z plane for the filter to be stable.

(a)

(b)

(c)
Figure 10 shows the pole-zero charts for three alternative filter designs to investigate stability difficulties and consequences. The pole and zero locations are utilised to determine the stability. It is clear from the figure that all three filters have the poles within the unit circle or on the origin. Pan–Tompkins filter has widespread poles and zeros within the unit circle. Thus, it is a case of not stable filter design.
For the reduced-order IIR filter, all poles and zeros lie in the origin; thus, this is the most stable case of the all. However, the proposed filter has amplitude of two poles that is greater than 1, which could lead to instability if it is not carefully built.
4.6.2. Evaluation Noise Power Spectrum
The comparison of the noise power spectrum for the 60-order filter and the proposed filter design is given in Figure 11. It can be observed from Figure 11 that our designed optimum reduced-order filter offers less noise spectrum performance. However, there may be scope of improvement further.

(a)

(b)
4.6.3. Phase Delay Performance
The phase delay (PD) rather than the group delay (GD) is used to determine the delay performance of a wave of a given frequency . The phase delay (PD) and group delay (GD) in nonlinear phase IIR filters are typically not the same because of system’s nonlinearity. It is required to design the filter with as close to linearity in order to maintain the shape of the ECG signals as shown in Figure 12.

(a)

(b)
Ps is the mathematical formula for phase shift, where Ps denotes the degree of phase shift, td denotes the time difference between signals and waves, and p is the wave period.
It is clear from the above figure that the suggested system achieves a nearly linear phase response. In addition, our lower order filter greatly reduces the amount of the phase delay. The justification of the improvement in the phase delay is evidently pragmatic from the judgement of the PD response for the IIR filter and ROIIR filter. The proposed ROIIR filter provides the almost flat linear phase response and thus offers better true nature of ECG signals as shown in Figure 13. The comparison of the filtered signal for the IIR filter and the reduced-order IIR filter is presented in Figure 14. This graph supports the claim that the proposed filter preserves the true nature of the ECG signal more effectively than the current filter. Phase delay and group delay responses are almost linear with the suggested filter.


(a)

(b)

(c)
4.7. Component Utilization Cost Summary for Filters
In this section, we have presented cost summary for the 60-order filter, the Pan–Tompkins filter, and the optimum reduced-order IIR filter as shown in Figure 15.

(a)

(b)

(c)
The comparison of the adders, multiples, and number of states used in the filter design is presented in tabular form in this section, as shown in Table 4.
It has been demonstrated that using a reduced-order filter design can significantly reduce implementation costs, allowing it to be used in on-chip applications for low latency and real-time systems. The main reason of shifting from the Pan–Tompkins filter to reduced-order filter is to make it stable and low cost.
(1) Cost Justification. The cost of implementation does not mean to only financial aspects, but it incorporates a number of components as adders, multipliers, and delay elements required to design the filters. Yadav et al. [24] have presented the performance evaluations of the cost implementation of different filters. Their best performance is found with elliptical filter, and the performance comparison is shown in Table 5 for the proposed IIR filter.
It can be concluded from Table 5 that proposed ROIIR filter minimized the cost of the implementation significantly.
5. Conclusion
This manuscript has presented the strategy results of concentrated optimum-order filter design projected at the front-end processing of the ECG signals. The first validated the filter design by Kumari and Singh [25] who have designed the two-stage IIR filter for the speech signal demising for digital hearing ads. In the current research, the similar two-stage modified IIR filter is used in context to ECG signal filtering.
Then, the results of the 60-order FIR sieve are validated for the ECG peak recognition followed by the validation of the Pan–Tompkins filter for peak detection. The prime goal of the research is to design the filter with the simple and cost-effective manner; nevertheless, it must retain the true ECG nature. In order to justify the effectiveness of the designed filter, the transfer functions are evaluated for the step response and stability analysis. The pole-zero analysis is used to assess the stability of three different filters used for ECG peak detections. It is found that proposed reduced-order filter is stable and has less impulse response magnitudes. The phase responses of the group delay of the 60-order FIR filter, the Pan–Tompkins filter, and the proposed reduced-order IIR filter are compared. It is clear from results that peak-to-peak delay and phase are minimized using the proposed IIR filter design.
Overall, it is concluded that the proposed reduced-order filter is capable of efficiently preprocess the ECG signal and used for the ECG artefact detection.
Data Availability
The data underlying this article are derived from online sources in the public domain as PhysioNet. The heart rates (ECG) are measured over 3 R-R intervals in beats per minute and available at https://physionet.org/physiobank/database/html/mitdbdir/records.htm.
Conflicts of Interest
The authors declare no conflicts of interest.