1 Introduction

Digital differentiators are considered as a fundamental building block in the diverse area of engineering related to biomedical, applied control, instrumentation, digital signal, and image processing. It derives the time derivatives of any measured and applied excitation to get useful responses according to their application needs [3, 19, 29]. The digital differentiator can be classified as the finite impulse response (FIR) systems and infinite impulse response (IIR) systems. For the same specifications, IIR systems intently provide low-order mathematical modeling as compared to the FIR systems. The frequency response of an ideal digital differentiator is given by

$$\begin{aligned} H(\omega )=j\omega \end{aligned}$$

where \(j=\sqrt{-1}\) and \(\omega \) is the angular frequency in radians.

The bilinear transform is a first-order approximation of the natural logarithm function, which approximates the magnitude response up to 0.3 of the normalized Nyquist frequency range [13, 22]. Another method for designing of a first-order digital differentiator is fractional bilinear transformation (FBT), proposed by Pie and Hsu using the concept of fractional delay [24]. Fractional bilinear transform increases the linear range, which yields low distortions in high-frequency range. Furthermore, Al-Alaoui proposed a novel approach to design a first-order digital differentiator by interpolating standard trapezoidal rule and rectangular rule linearly [4, 5]. This transform shows linearity up to 0.7 of the full normalized Nyquist frequency range. All the above-mentioned first-order differentiator designs approximate the magnitude response up to a fraction of the full band of Nyquist range.

In the literature, the approach for the design of IIR differentiators is based on the traditional aspect of approximation, optimization and interpolation techniques [1, 6,7,8, 15, 16, 23, 25,26,27]. In 2014, Al-Alaoui proposed the design of four-segment second-order differentiator, which is derived from numerical integration rules and optimization using simulated annealing (SA) with absolute relative magnitude error (ARME) of 13.032 over \(0\le \omega \le \pi \) [9]. Nam Ngo has used the Newton–Cotes integrations method to design third-order differentiator [21]. Jain et al. proposed a second-order digital differentiator by using genetic algorithm in 2012 [17]. It provides an absolute relative magnitude error of 0.8777 over \(0 \le \omega \le 0.95\pi \). Upadhyay suggests a class of wideband integrator and differentiator by optimizing the pole-zero locations of the existing differentiators in 2012, with an absolute relative magnitude error of 1.1959 over \(0 \le \omega \le 0.93\pi \) [28]. Likewise, Hsu et al. proposed the second-order digital differentiator in 2008, by employing the concept of fractional bilinear transformation [24]. Furthermore, an optimal design of L1-norm-based IIR digital differentiators are presented by Apoorva et al. in 2017, to provide absolute relative magnitude error of 1.6054 over \(0 \le \omega \le \pi \) [2]. The methods mentioned above are used to design full-band digital differentiators. These methods have no flexibility to design digital differentiators in the specified frequency range of interest.

In this paper, a generalized Nth-order digital differentiator is designed by fractional interpolation of rectangular and trapezoidal transform. The basic idea originates from observing that the ideal differentiator response lies between rectangular rule and trapezoidal rule [5]. Therefore, the differentiator is obtained by interpolating the rectangular and trapezoidal rule fractionally, followed by optimization of weighting variable a and fractional delay variable d. Proposed designs show mean relative magnitude error \(-\,27.702\) dB and \(-\,35.04\) dB for the first order and second order, respectively, over \(0 \le \omega \le \pi \). These low-order, two-variable design equations are flexible enough to give an optimum magnitude response for any desired digital frequency ranges. Therefore, the proposed results for digital differentiators indicate that fractional interpolation technique constitutes an attractive alternative for digital differentiator designs.

The rest of the paper is organized as follows: Section 2 deals with a brief description of the ideal mathematical model and corresponding fractional bilinear transform. Section 3 describes fractional interpolation technique for the first-order and second-order differentiators, and all the comparisons of the proposed design with the existing designs of their corresponding order. It also includes the proposed first-order and second-order designs for different frequency ranges. Section 4 concludes the paper.

2 Motivation

IIR filters are designed by mapping an analog system H(s) into a digital system transfer function H(z). The bilinear transform fulfills all the requirements of mapping from s-plane to z-plane and preserves stability. Though it belongs to nonlinear tangent curve transformation, which produces substantial magnitude distortions in the high-frequency range, it perfectly matches the magnitude response up to \(0.3\pi \) of the full Nyquist frequency range [13, 22]. The bilinear transform is given by

$$\begin{aligned} s =\frac{2}{T}\frac{1-z^{-1}}{1+z^{-1}} \end{aligned}$$

where T is the sampling time.

$$\begin{aligned} H(e^{j\omega T}) =\frac{2}{T}\frac{1-e^{j\omega T}}{1+e^{j\omega T}} =\frac{2}{T}\ j \tan \frac{\omega T}{2} \end{aligned}$$

Fractional bilinear transform is given by [24]

$$\begin{aligned} F_\mathrm{frac}(z) =\frac{2}{dT}\frac{1-z^{-d}}{1+z^{-d}} =\frac{2}{dT}\ j \tan \frac{\omega d T}{2} \end{aligned}$$
(1)

where d is the fractional delay variable, \(0 \le d \le 1\) and T is taken as 1, if there is no other assignment. This transfer function tends to \(j \omega \) if d advent to zero, that is

$$\begin{aligned} \lim _{d\rightarrow 0}F_\mathrm{frac}(e^{j\omega T})=j\omega \end{aligned}$$
(2)

It is quite similar to the bilinear transform in which \(z^{-1}\) is replaced by \(z^{-d}\), due to which period of \(2\pi \) becomes \(2\pi /d\). Though it is not an integer delay, it can be approximated for practical realization.

3 Fractional Interpolation Technique for Digital Differentiator

Al-Alaoui introduced interpolation of trapezoidal and rectangular integration rules [4, 5], which results in the following

$$\begin{aligned} H(z)=aH_\mathrm{Rect}(z)+(1-a)H_\mathrm{Trap}(z) \end{aligned}$$
(3)

where a is the weighting variable, \(0 \le a \le 1\). It yields the following transformation.

$$\begin{aligned} s=\frac{2(1-z^{-1})}{T(1+a)+(1-a)z^{-1}} =\frac{2}{T(1+a)}\Bigg [\frac{1-z^{-1}}{1+\frac{(1-a)}{(1+a)}z^{-1}}\Bigg ] \end{aligned}$$
(4)

Replacing \(z^{-1}\) by \(z^{-d}\), its fractional equivalent is given by

$$\begin{aligned} F(z)=\frac{2}{d T(1+a)}\Bigg [\frac{1-z^{-d}}{1+\frac{(1-a)}{(1+a)}z^{-d}}\Bigg ] \end{aligned}$$
(5)

where d and a vary from 0 to 1. The transfer function F(z) also approaches to \(j \omega \) if d and a approach zero.

$$\begin{aligned} \lim \limits _{{d\rightarrow 0},{a\rightarrow 0}}F_\mathrm{frac}(e^{j\omega T})=j\omega \end{aligned}$$
(6)

In practice, fractional delay needs an approximation to its integer delay [18, 24].

$$\begin{aligned} z^{-(I+d)}\cong \sum \limits _{n=0}^{N} h(n)z^{-n} \end{aligned}$$
(7)

where

$$\begin{aligned} h(n)=\prod \limits _{{m=0},{m\ne n}}^N \frac{I+d-m}{n-m} \end{aligned}$$
(8)

Here, I is the integer delay and N is the order of the generalized transfer function for \(0 \le d \le 1\), \(0 \le a \le 1\), Equation (5) can be rewritten as

$$\begin{aligned} F(z)=\frac{2}{d T(1+a)} \left[ \frac{z^{-I}-z^{-(I+d)}}{z^{-I}+\frac{(1-a)}{(1+a)}z^{-(I+d)}}\right] \end{aligned}$$

Substitution of \(z^{-(I+d)}\), h(n), from Eqs. (7) and (8), respectively, yields

$$\begin{aligned} F(z)=\frac{2}{d T(1+a)} \left[ \frac{z^{-I}-\sum \nolimits _{n=0}^N \Bigg (\prod \nolimits _{\begin{array}{c} m=0 \\ m\ne n \end{array}}^N \frac{I+d-m}{n-m} \Bigg )z^{-n}}{z^{-I}+\frac{1-a}{1+a}\sum \nolimits _{n=0}^N \Bigg (\prod \nolimits _{\begin{array}{c} m=0 \\ m\ne n \end{array}}^N \frac{I+d-m}{n-m}\Bigg )z^{-n}}\right] \end{aligned}$$
(9)

The above equation represents the transfer function of an Nth-order digital differentiator. The generalized equation has four parameters I, N, d and a, to tune frequency response of differentiator.

For \(I=0\), \(N=1\), generalized transfer function of the first-order digital differentiator is given by

$$\begin{aligned} F_1(z)=\frac{2}{ T(1+a)}\left[ \frac{1-z^{-1}}{1+\frac{1-a}{1+a}(1-d)+\frac{1-a}{1+a}dz^{-1}}\right] \end{aligned}$$
(10)

For \(I=1\), \(N=2\), generalized transfer function of the second-order digital differentiator is given by

$$\begin{aligned} F_2(z)= & {} \frac{2}{d T(1+a)}\left[ \frac{z^{-1}-\sum \nolimits _{n=0}^2 \Bigg (\prod \nolimits _{\begin{array}{c} m=0 \\ m\ne n \end{array}}^2 \frac{1+d-m}{n-m}\Bigg )z^{-n}}{z^{-1}+\frac{1-a}{1+a}\sum \nolimits _{n=0}^2 \Bigg (\prod \nolimits _{\begin{array}{c} m=0 \\ m\ne n \end{array}}^2 \frac{1+d-m}{n-m}\Bigg )z^{-n}}\right] \nonumber \\&\left[ \frac{2(1-d)+4dz^{-1}+2(1+d)z^{-2}}{d(1-a)(d-1)+ (4-2d^2(1-a))z^{-1}+d(1+d)(1+a)z^{-2}}\right] \nonumber \\ \end{aligned}$$
(11)
Fig. 1
figure 1

Magnitude response comparison of the first-order digital differentiator

Fig. 2
figure 2

Absolute magnitude error comparison of the first-order digital differentiator

The two variables a and d can be optimized by using an optimization algorithm to minimize the error functions [26], defined in Eqs. (12) and (13) for the first-order and second-order differentiators, respectively.

$$\begin{aligned} E_{1}= & {} \int _{0}^{\pi } (\vert F_1(z)_{z=e^{j\omega }}\vert - \omega )^2 \mathrm{d}\omega \end{aligned}$$
(12)
$$\begin{aligned} E_{2}= & {} \int _{0}^{\pi } (\vert F_2(z)_{z=e^{j\omega }}\vert - \omega )^2 \mathrm{d}\omega \end{aligned}$$
(13)

Genetic algorithm is used to find the optimum values of the variables a and d by minimizing the error objective functions. Genetic algorithm is a highly flexible, population-based, bio-inspired global optimization technique. It uses probabilistic transition rules, which makes it an efficient and effective optimization technique stochastically. So, it can be befitted to get the minimum absolute magnitude error [20].

3.1 Proposed Design for the First-Order Differentiator

Using the exercised approach explained in the previous section, a first-order differentiator is proposed by taking the optimum value of a and d. It is essential to mention here that, for \(a=0.5\) and \(d=0.5\), Eq. (10) reduces to Al-Alaoui transform.

In design-1, for full-band digital differentiator, the optimum values of a and d are 0.61, 0.816, respectively, with constant multiplier 0.9686. These values lead to the following transfer function.

$$\begin{aligned} F_{1}(z)=\left[ \frac{1.18z-1.18}{1.04z+0.17910}\right] \end{aligned}$$
(14)

Figures 1 and 2, respectively, compare the magnitude responses and absolute magnitude error of the proposed designs and existing designs with ideal differentiator. It is shown in Fig. 1 that the magnitude response of the full-band differentiator (design-1) overlapped with ideal magnitude response up to \(0 \le \omega \le 0.8 \pi \). The magnitude error obtained is less than 0.03 for \(0 \le \omega \le 0.8\pi \) as observed in Fig. 2. Statistical comparison shown in Table 1 shows the superiority of design-1 as compared to the existing designs in terms of ARME, MRME and SD.

In design-2, for full-band digital differentiator, the optimum values of a and d are 0.898 and 0.95, respectively, with constant multiplier 0.951. These values lead to the following transfer function.

$$\begin{aligned} F_{1}(z)=\left[ \frac{1.163z-1.163}{1.023z+0.2005}\right] \end{aligned}$$
(15)

In order to show the efficiency of the proposed design-2, Fig. 1 depicts the substantial linearity for the full Nyquist range. The absolute magnitude error (Fig. 2) remains less than 0.31 for the entire Nyquist range. Table 1 indicates that the absolute and mean relative errors are observed to be lowest (12.9665 and \(-\,27.702\) dB, respectively), which shows significant improvement of 31.33 % as compared to the Al-Alaoui transform [4, 5] in terms of ARME. On the basis of the above discussion, it can be concluded that the design-2 is superior to the other differentiators tabulated in Table 1, for \(0 \le \omega \le \pi \).

Table 1 Statistical comparison of the proposed first-order digital differentiator with the existing designs
Fig. 3
figure 3

Magnitude response comparison of the second-order digital differentiator

Fig. 4
figure 4

Magnitude response comparison of the second-order digital differentiator

Table 2 Statistical comparison of the proposed second-order digital differentiator with the existing second-order designs

3.2 Proposed Design for the Second-Order Differentiator

From Eq. (11), a second-order differentiator can be designed by using the optimum values a and d as \(a=0.75\), \(d=0.165\), respectively, with a constant multiplier \(-\,1.026\), which leads to the following transfer function.

$$\begin{aligned} F_{2}(z)=\left[ \frac{0.5048z^2+3.094z-3.599}{0.1549z^2-3.051z-1.104}\right] \end{aligned}$$
(16)

The poles of this transfer function are at \(-\,0.3554\) and 20.0520. The pole reflection approach is used to make the system stable without affecting its magnitude response and corresponding minimal relative errors [22]. The transfer function of the proposed second-order differentiator is given by:

$$\begin{aligned} F_{2}(z)= & {} \left[ \frac{0.5048z^2+3.094z-3.599}{(0.1549)(z+0.3554) (z-20.052)}\right] \nonumber \\= & {} \left[ \frac{0.5048z^2+3.094z-3.599}{(0.1549)(z+0.3554)(z-20.052)}\right] \times \left[ \frac{z-20.052}{-20.052z+1}\right] \nonumber \\ F_{2}(z)= & {} \left[ \frac{0.5048z^2+3.094z-3.599}{-3.106z^2-0.94899z+0.054276}\right] \end{aligned}$$
(17)

Figures 3 and 4 show absolute magnitude responses and absolute magnitude error, respectively. Table 2 enlists some analytical results for all the mentioned designs.

The absolute magnitude error, for the proposed differentiator, is less than 0.028 for \(0 \le \omega \le 0.92 \pi \) and 0.21 for \(0 \le \omega \le \pi \), as shown in Fig. 4. In terms of ARME and MRME (dB), the proposed design outranges the existing Al-Alaoui four-segment [9] and Hsu et al. [24] for \(0 \le \omega \le \pi \). However, the absolute magnitude error is slightly higher than the differentiators proposed by Jain et al. [17], Apoorva et al. [2] and Upadhyay [28] over \(0 \le \omega \le \pi \).

Table 3 Proposed first-order design parameter values for various frequency ranges
Table 4 Proposed second-order design parameter values for various frequency ranges

3.3 Proposed Designs for Different Frequency Ranges

The design Eq. (10) for the first order and Eq. (11) for the second order provide the flexibility for designing the best approximation of the ideal differentiator for the required frequency range, especially the first order, because less order means less computation and design complexity. For any required frequency range, the design equations for the first order and second order are utilized to optimize the values of a and d. Tables 3 and 4 show some set of values a and d for various frequency ranges with their absolute magnitude error for the first-order and second-order designs.

4 Conclusion

In this paper, a novel approach to design an Nth-order IIR digital differentiator is presented. The proposed approach involves optimization of two parameters, fractional delay (d) and weighting variable (a). The two variables are optimized to approximate the frequency response of the proposed differentiators in the entire Nyquist range or, for the frequency range of interest. In the proposed design, the first-order transfer function shows improvement of 31.33 % in terms of ARME over the first-order Al-Alaoui differentiator. Absolute relative magnitude error and mean relative magnitude errors (dB) obtained are 12.9665 and \(-\,27.702\), respectively, for the full normalized frequency band. Moreover, the second-order design also shows an absolute relative magnitude error and mean relative magnitude errors (dB) as 5.5647 and \(-\,35.04\), respectively, which are significantly comparable to the existing designs of the second-order differentiators. In future, the proposed approach can be used for designing low-order optimized IIR integrators. Furthermore, the development of new operators related to the fractional differentiators establishes new insight interest in the various fields of engineering. Therefore, this concept may be used to design fractional order differentiator to set up substantial accuracy in the modeling of different systems [10,11,12, 14].