Upload
tkbattula
View
8
Download
3
Embed Size (px)
DESCRIPTION
paper on digital differentiators and applications
Citation preview
On design and applications of digital differentiatorsB. T. Krishna
Department of E.C.EGITAM University
Visakhapatnam, 530045, IndiaEmail: [email protected]
S. Srinivasa RaoDepartment of E.C.EGITAM University
Visakhapatnam, 530045, IndiaEmail: [email protected]
Abstract—This paper deals with the design and applications ofdigital differentiators. For real time applications it is m andatorythat a differentiator should have as small an order as possible.Different procedures available for the design of FIR and IIRtype digital differentiators are presented. The IIR Type digitaldifferentiators are obtained by inversion and magnitude stabiliza-tion of the existing digital integrators. In some applications likecontrols, waveshaping, oscillators and communications require aconstant 900 phase for differentiators. In this paper an attemptis made to study about the variation of phase angle of digitaldifferentiators with the application of fractional delay. The use ofdigital differentiators for the detection of edges in an image, QRSdetection in an ECG signal is illustrated. It has been observedthat the digital differentiators have shown superior performancecompared to the well known gradient method. With the provenefciency of the differentiators in various applications, they havebeen implemented in hardware using Verilog.
Index Terms—Digital differentiator, Digital Integrator, IIRFilter, FIR Filter, Interpolation, Simpson Integration Fo rmula,Fractional delay, Rectangular rule, Edge detection etc.
I. I NTRODUCTION
Digital differentiators are used to find the time-derivative ofthe incoming signal [1-3] and are defined as,
G (jω) = jω (1)
These devices are used in almost all fields of engineeringlike instrumentation, control systems, digital signal andimageprocessing, bio-medical engineering and other allied fields. So,the design of digital differentiators is of considerable interest.For real-time dynamic applications, a differentiator shouldhave a wide band frequency response and should have a groupdelay as short as possible. For easy practical Implementation,a low-order is more favourable.
Rabiner and Steiltz,[3] has presented the design of recursiveand non recursive digital differentiators. They have made useof square error criterion for the design of recursive differen-tiators, while sampling technique is used for the design ofnon-recursive digital differentiators.
Taylor series approximations[2] have been widely usedto derive differentiators.They are all in the form of centraldifference approximations. It has been observed that the higherthe order, the closer that a Taylor series approximation is tothe ideal differentiator.
Digital differentiator can be either FIR or an IIR type.AFIR filter of type III has an odd length and antisymmetric
impulse response.Theoretically, FIR filters of type III canbedesigned to meet requirements at nearly all frequencies, withincreased filter order[6]. A FIR filter of type IV has an evenlength and antisymmetric impulse response.The type IV FIRdifferentiators are found to be superior to the type III FIRdifferentiators in terms of the frequency response.
Kumar and Dutta Roy,presented optimal and maximallylinear FIR differentiators for low-frequency, mid-frequency,and around specific frequency respectively[6]. They gave theexplicit formulae and efficient recursive algorithms to calculatethe impulse response of filters. Although different proceduresexist for the design of FIR type differentiators for differentfrequency regions,the differentiators obtained suffer from theproblem of higher order,high cost and space making themunsuitable for real-time applications. In 1992, Al-Alaouihasproposed a procedure for the design of IIR type digitaldifferentiators, which is based on the inversion and magnitudestabilization of the transfer function of digital integrators[9-12]. In this paper an attempt is made to study about the designof FIR and IIR type digital differentiators.
Fractional Delay filters have been widely used in areassuch as arbitrary sampling rate conversion, synchronization ofdigital modems and speech coding etc.In this paper an attemptis made to apply fractional delay to digital differentiatorsto achieve constant phase angle, and is illustrated with anexample.
The organization of the paper is as follows. Section 2 dealswith the design of FIR type and IIR type digital differentia-tor.Section 3 illustrates the application of fractional delay toIIR type digital differentiators. The use of digital differentia-tors in detecting edges in an image, QRS detection in an ECGsignal is illustarted in Section 4. Hardware implementation ofdigital dif- ferentiators using Verilog is presented in Section5. Results and conclusions are presented in section 6.
II. D ESIGN OFDIGITAL DIFFERENTIATORS
A. Taylor Series Method
Taylor series approximations have been widely used toderive differentiators [2].They are all in the form of centraldifference approximations such as
y(n) =
∫ N
k=−N
c (k)x(n−k) (2)
Fig. 1. Magnitude response of Taylor series based digital differentiators.
whereN is the order of Taylor series approximation. The co-efficients can be calculated as,
c (k)=−c (k)=(−1)k+1 N !2
k (N−k) ! (N + k) !, c(0) = 0 (3)
The magnitude response of the digital differentiators obtainedusing Taylor series expansion is as shown in Fig.1.It isapparent that the higher the order, the closer that a Taylorseries approximation is to the ideal differentiator.
B. FIR type differentiators
For a causal FIR differentiator[3,4,6,7],
y(n) =
∫ N
k=0
c (k)x(n−N) (4)
cd [n] =
∫
π
−π
jωe−jω(n−M)
dω =cos ([n−M ] π)
(n−M)−
sin ([n−M ] π)
π(n−M)2(5)
Where M=N/2.The maximally flat FIR approximation to theideal differentiator satisfies the derivative constraints.
|G(jω)| = 0 at ω = 0 (6)
∣
∣
∣
∣
dG(jω)
dω
∣
∣
∣
∣
= 1 at ω = 0 (7)
∣
∣
∣
∣
dkG(jω)
dωk
∣
∣
∣
∣
= 0 at ω = 0 2 = k = B − 1 (8)
Where B is the number of the free parameters. Notice that theapproximation is performed at a single frequency pointω =0. Kumar and Dutta Roy described how the solution can beobtained from the maximally flat low-pass FIR filter. Type IIIand IV Low-pass digital differentiators are explained as below.
1) Type III and IV FIR Differentiators: A FIR filter of typeIII has an odd length and antisymmetric impulse response.
cd[n] =
{
cos(n−M)πn−M
n 6= M
0 n = M(9)
To eliminate the Gibbs phenomenon due to the finite trunca-tion, a window function is required. Theoretically, FIR filtersof type III can be designed to meet requirements at nearly allfrequencies, as long as we increase the filter order.The TypeIII transfer function can be written as,
H4 (z) =1
4
(
1− z−1) (
1 + z−1)
H(z) (10)
That means a Type III transfer function always has a zero atz = -1 and 1 whose frequency response can be written as,
H4
(
ejω)
= je−jωsin(ω
2
)
cos(ω
2
)
H(ejω) (11)
A FIR filter of type IV has an even length and antisymmetricimpulse response.The type IV FIR differentiators are superiorto the type III FIR differentiators in terms of the frequencyresponse, since they have no disadvantageous characteristic ofbeing zero atω = 1. The Type IV transfer function can bewritten as,
H4 (z) =1
2
(
1− z−1)
H(z) (12)
That means a Type IV transfer function always has a zero atz = 1 whose frequency response can be written as,
H4
(
ejω)
=1
2
(
1− e−jω
)
H(ejω) = je−jω/2
sin
(
ω
2
)
H(ejω)
(13)
C. IIR Type Digital Differentiators
An IIR type digital differentiator will be obtained froma digital integrator. An ideal integrator is defined by thefollowing transfer function [8-11],
HI (jω)=1
jω(14)
The commonly used digital integrators are, Backward orrectangular integrator,
H1 (z) =zT
z − 1(15)
Tustin or trapezoidal integrator,
H2 (z) =T (z + 1)
2(z − 1)(16)
Simpson’s integrator,
H3 (z) =T (z2 + 4z + 1)
3(z2 − 1)(17)
Tick integrator,
H4 (z) =T (0.3585z2 + 1.2832z + 0.3584)
(z2 − 1)(18)
A Third order Digital Integrator is defined as,
H5 (z) =T (z + 2.3658)
(
z2 + 1.1752z + 0.047)
2.7925z2(z − 1)(19)
0 0.5 1 1.5 2 2.5 30
0.5
1
1.5
2
2.5
3
Frequency
Magn
itude
Comparison of Magnitude responses of Digital Integrators
Ideal
H1(z),Backward
H2(z),Bilinear
HAL
(z),Al-Alaoui
H3(z),Simpson
H4(z),Tick
H5(z),Ngo
Fig. 2. Comparison of magnitude responses IIR type digital integrators.
Comparison of magnitude response of the above mentioneddigital integrators is presented in Fig.2.
From the figure it can be observed that the magnituderesponse of an ideal integrator lies between rectangular andtrapezoidal integrators and also between trapezoidal and simp-son integrators. In[8-10], the following approach is proposedby Al-Alaoui for the design of IIR type digital differentiators.
1) Design an integrator that has the same range and accu-racy as the desired differentiator and Invert the transferfunction.
2) Reflect the poles that lie outside the unit circle to inside,in order to stabilize the resultant transfer function.
3) Compensate the magnitude using the reciprocals of thepoles that lie outside the circle.
1) First order Al-Alaoui Digital Differentiator: The Firstorder Integrator is obtained by the Interpolation of Rectangularand trapezoidal Integrators [8].So,
HAL (z) = αH1 (z) + (1− α)H2 (z) (20)
Whereα lies between 0 and 1. Forα= 34 the above equation
reduces to,
HAL (z) =3
4H
1(z) +
1
4H
2(z) (21)
SubstitutingH1 (z) and H2 (z) in the above equation andsimplifying,
HAL (z) =T (z + 7)
8 (z − 1)(22)
Reflecting the zeroz = -7 with its reciprocal -1/7, and com-pensating the magnitude results in a minimum phase digitalintegrator with the transfer function
HAL (z) =7T (z + 1/7)
8 (z − 1)(23)
Inverting the above transfer function yields the Al-Alaoui’sstabilized IIR differentiator of the first order
GAL(z) =8(z − 1)
7T (z + 17 )
(24)
2) Second order Digital Differentiators: The Tick integra-tor has two real poles located atz = ±1 whose transferfunction is given by [9],
H4 (z) =T (0.3585z2 + 1.2832z + 0.3584)
(z2 − 1)(25)
By following the above mentioned Procedure the followingtransfer function obtained for the digital differentiatoris,
G4 (z) =0.852(z2 − 1)
(z2 + 0.611z + 1)(26)
The transfer function of the Simpson’s integrator is
H3 (z) =T (z2 + 4z + 1)
3(z2 − 1)(27)
The corresponding transfer function of the digital differentiatorwill be,
G3 (z) =0.8038(z2 − 1)
T (z2 + 0.5358z + 0.0718)(28)
By interpolating the Simpson and trapezoidal digital integra-tors the following hybrid digital integrator is obtained
HAL2 (z) = αH3 (z) + (1− α)H2 (z) (29)
Substituting the expressions of Simpson’s and the trapezoidalintegrators,the following is the expression for the new digitalintegrator,
HAL2 (z) =T (3− α)
(
z2 + 2(3+α)3−α
z + 1)
6(z2 − 1)(30)
for α = 0.6,
HAL2 (z) =0.4T
(
z2 + 2.5z + 1)
(z2 − 1)(31)
Following the above mentioned procedure, the digital differ-entiator obtained will be,
GAL2 (z) =1.25(z2 − 1)
T (z2 + z + 0.25)(32)
3) Third order or wide-band Digital Differentiator: In2006,N.Q.Ngo has derived an expression for wideband digitalintegrator which is defined as [12],
H5 (z) =T (z + 2.3658)
(
z2 + 1.1752z + 0.047)
2.7925z2(z − 1)(33)
Following the above Procedure and stabilizing the transferfunction the following digital differentiator is obtained.
G5 (z) =1.1804z2(z − 1)
T(
z3 + 0.168z2 − 0.0607z + 0.0198) (34)
Fig. 3. Comparison of magnitude responses of IIR Type digital differentia-tors.
Fig. 4. Comparison of phase responses of IIR Type digital differentiators.
The magnitude and phase responses of the digital differen-tiators were compared in Fig.3 and 4 respectively.Percentrelative error of the magnitude responses of all the designeddifferentiators is presented in Figure.5. It can be observedfrom Figs.3,4 and 5 that,
1) Al-Alaoui first order differentiator approximates theideal differentiator till 0.78 of the full band.The thirdorder digital differentiator can be used as a wide-banddigital differentiator.Differentiator obtained from thein-version of the trapezoidal integrator has phase responsecloser to ideal one.
2) The inverse Simpson differentiator has the poorest highfrequency response and has good low frequency re-sponse up to 0.4 of the full band.Differentiator fromthe tick integrator is linear till 0.5 of the full band. Al-
Fig. 5. Percent relative error.
Alaoui second order differentiator has exhibited goodlow frequency response.
3) First order and Third order digital differentiators hasexhibited ±10 percent relative error for higher rangeof frequencies.The lower order of these digital differ-entiators makes them suitable in real time applicationslike radars, sonar’s, bio-medical engineering, speechprocessing,Global positioning system etc.
III. A PPLICATION OFFRACTIONAL DELAY TO DIGITAL
DIFFERENTIATORS
The transfer function of an ideal delay element may bewritten as [15-16],
H (z) =Y (z)
X(z)= z−D (35)
For the sake of discussion, assume that D is a positive realnumber, defined as the sum of its integer part, N, and thefractional part, d.
D = N + d (36)
In the frequency domain, the ideal fractional-delay filter canbe described as,
H(
ejω)
= e−jωD (37)
i.e., the magnitude response for an ideal delay element is unityfor all frequencies, while the phase response is linear withaslope of -D. The delay can be calculated by using FIR andIIR approximations.A.Thiran All pass filter: With this approximation the totaldelay D is approximated by an IIR filter as [15-16],
z−D =a0 + z−1a1 + z−2a2 + . . . z−mamb0 + z−1b1 + z−2b2 + . . . z−nbn
(38)
ak = (−1)kCN
k
N∏
n=0
N − n−D
N − n− k −D(39)
Fig. 6. Fractional delay applied to Al−Alaoui digital differentiator.
TABLE IAPPROXIMATIONS OFFRACTIONAL DELAY, D=0.5
Delay,d FIR Approximation IIRApproximation
0.1 1+z−1
10
9+11z−1
11+9z−1
0.2 1+z−1
5
8+12z−1
12+8z−1
0.3 1+z−1
10/37+13z−1
13+7z−1
0.4 1+z−1
2.56+14z−1
14+6z−1
0.5 1+z−1
2
5+15z−1
15+5z−1
0.6 1+z−1
5/34+16z−1
16+4z−1
0.7 1+z−1
10/73+17z−1
17+3z−1
0.8 1+z−1
5/42+18z−1
18+2z−1
0.9 1+z−1
10/91+19z−1
19+z−1
WhereCNk = N !
k!(N−k)! andD = N + d.B. Lagrange interpolation FIR Delay filter: With this ap-proximation, a total delay D is approximated by a FIR filteras [15-16],
z−D =
L∑
n=0
h[n]z−n (40)
The filter-order L is chosen such thatL−12 = D = L+1
2 . Thetransfer functions obtained for FIR and IIR approximationsdifferent values of d are tabulated in Table.1.The fractionaldelay will be applied to the differentiator as follows. Multiplythe transfer function of the digital differentiator withz
−N
z−N−d
where N is the integer delay d is the fractional delay. Bydoing so to an Al-Alaoui first order digital differentiator thephase angle variation is as shown in Fig.6. From the figureit is evident that the phase angle can be made constant bychoosing different values of N and d. The same approach canbe applied to other differentiators with linear or approximatelylinear phases.
TABLE IIRMSEFOR DIGITAL DIFFERENTIATORS
Digital differentiator RMSEBackward 0.0024167Bilinear 0.0025429Alaloui 0.0024364Simpson 0.0025993Tick 0.0026045Gradient 0.0025219Ngo 0.0021188
IV. A PPLICATIONS OF DIGITAL DIFFERENTIATORS
A. Edge detection using Digital Differentiators
Edge detection refers to the process of identifying andlocating sharp discontinuities in an image [13].The majorityof different methods may be grouped into two categories asgradient method and Laplacian method. The gradient methoddetects the edges by looking for the maximum and minimumin the first derivative of the image. The Laplacian methodsearches for zero crossings in the second derivative of theimage to find edges. The popular edge detection operators areRoberts, Sobel, Prewitt, Frei-Chen, and Laplacian operatorsetc [13,14,17]. In this paper first and second order derivativeof the image is considered. The procedure for the edgedetection using IIR type digital differentiators is as follows.The difference equation of third order digital differentiatorwith input x [n] and outputy [n] in time domain atT = 1can be written as,
y[n] =1
b0
[
a0x[n] + a1x[n− 1] + a2x[n− 2] + a3x[n− 3]−b1y[n− 1]− b2y[n− 2]− b3y[n− 3]
]
(41)Consider an imagef(x, y) . The Gradient of the image canbe written as,
∇f (x, y) =∂f (x, y)
∂xux +
∂f (x, y)
∂yuy (42)
whereux, uy are the unit vectors inx and y directions. Theapproximated magnitude of the Gradient is,
G = |Gx|+ |Gy| (43)
Consideringx [n] = f(x, y) and applying it to a digitaldifferentiator the outputs are calculated both inx and ydirections individually, and the gradient is to be calculatedusing Eqn.43.The figure of merit of edge detectors Root-meansquare errorERMS is given by,
ERMS =
√
√
√
√
1
MN
M−1∑
x=0
N−1∑
y=0
[f (x, y)− fedge(x, y)]2 (44)
where f (x, y) is the original image of sizeM × N andfedge(x, y) is the edge detected image. The results obtainedby using the above mentioned procedure is shown in Fig.7 and8.
Original Bilinear
Al-Alaoui Backward
Fig. 7. Edge detection using digital differentiators.
Gradient Tick
Simpson Ngo
Fig. 8. Edge detection using digital differentiators.
B. QRS detection
Electro Cardio Gram(ECG) is the electrical activity of theheart is perhaps the most commonly known, recognized, andused biomedical signal. A QRS de- tection technique designedby Dobbs et al.which uses cross correlation was followed inthis paper[19,22,23]. The block diagram used for the detectionof QRS signal is shown in the Fig.9. The results obtainedusing the procedure depicted in Fig.9 is shown in Figs.10-11.Although Al-Alaoui differentiator is considered here, thesamecan be extended to other differentiators also.
V. HARDWARE IMPLEMENTATION OF IIR TYPE DIGITAL
DIFFERENTIATORS
In general, Direct form-I, Directform-II, Cascaded form,Parallel form are used for the implementation of any digital
Fig. 9. Block diagram of the Program flow
Fig. 10. QRS Template
lter. Because of the less hardware requirement, Directform-II is preferred compared to other implementations. A RTLschematic is shown in Fig.12. The above algorithm is im-plemented in Verilog.The Corre- sponding input and outputsignals are shown in Fig.13.
VI. RESULTS AND CONCLUSIONS
In this paper, theory of operation, applications and imple-mentation of digital differentiators is presented. A studyonthe design of digital differentiators reveals that type IIIFIRdifferentiators have the inherent nature in frequency responseof approaching zero at Nyquist frequency. To extend the per-formance of type III FIR lters in the higher frequency bands,one has to increase the lter taps. Type IV FIR differentiators
Fig. 11. Detected QRS sequences using Al-Alaoui rst order digital differ-entiator
Fig. 12. RTL Schematic for Simpson digital differentiators
Fig. 13. Simulation Result of Simpson digital differentiators
using Fourier series have been found to have out- standing fre-quency response, however, they are noisy and biased. Higherorder central difference approxima- tions using Taylor seriesmight outperform windowed Fourier series since there is notruncation and the associated Gibbs phenomenon. IIR digitaldifferentia- tors are more favourable for real-time application.The rst-order IIR differentiator from Al-Alaoui is ideal interms of the frequency response. The IIR differentiators can beadaptively used when systems experience high dynamics. Thedigital differentiators of IIR type have been proved to be muchmore efcient in detecting edges of an image, QRS detectionetc.
REFERENCES
[1] S.K.Mitra, Digital signal processing a computer based approach,TataMcGraw Hill edition,Newdelhi, 2001.
[2] I.R.Khan,R.Ohba, Digital differentiators based on taylor series-IEICEtrans. fundamentals, Vol.E82-A,No.12,PP.2822-2824,Dec.1999.
[3] Lawrence R.Rabiner,K.Steiglitz, The design of wide-band Recursive andnon recursive digital differentiators-IEEE transactions on audio andelectroaccoustics, vol.AU-18.no.2 June 1970.
[4] Lawrence R.Rabiner, Ronald W.Schafer,Recursive and non recur-sive realizations of digital filters designed by frequency samplingtechniques- IEEE transactions on audio and electroaccoustics,vol.AU-19.no.3 September 1971.
[5] B.Kumar,S.C.Dutta Roy, Design of digital differentiators for low fre-quenciesProc.IEEE, vol.76, pp.287-289, 1988.
[6] C.K.Chen, J.H.Lee, Design of high-order digital differentiators usingL1 error criterion- IEEE transactions on circuits and systems, vol.-42.no.4,April 1995.
[7] S.C.Pei, J.J.Shyu, Analytic closed-form matrix for designing higherorder digital differentiators using Eigen approach-IEEE transactions onsignal processing,vol.-44.no.3, March 1996.
[8] M.A.Al-Alaoui, Novel Digital integrator and Differentiator-IEEE Elec-tronic Letters, Vol.29, no.4, pp.376-378,Feb.1993.
[9] M.A.Al-Alaoui, Novel approach to designing Digital Differentiators-IEEE Electronic Letters, Vol.28, no.15,pp.1376-1378, Jul.1992.
[10] M.A.Al-Alaoui,Novel IIR Digital Differentiator From Simpson Inte-gration Rule-IEEEtransactions on Circuits Systems.I ,Fundam TheoryAppl., Vol.41,no.2, pp.186-187, Feb.1994.
[11] J.L.Bihan,Novel class of Digital integrators and Differentiators-IEEEElectronic Letters,Vol.29, no.11, May.1993.
[12] Nam Quoc Ngo,A New Approach for the Design of Wideband Dig-ital Integrator and Differentiator-IEEE Transactions on Circuits andSystems-II,Vol.53, No.9, September 2006.
[13] Gonzalez, Woods,Digital Image Processing,Prentice Hall, 2008.[14] L.S.Davis, Edge detection techniques,Computer Graphics Image
Process.,Vol.4,pp.248-270, 1995.[15] T.I.Laakso,V.Valimaki,M.Karjalainen,U.K.Laine, Splittingthe Unit De-
lay, IEEE Signal Processing Magazine,vol.13,no.1,pp.30-60,Jan.1996.[16] V.Valimaki, PhD Thesis,Discrete-Time Modeling of Acoustic Tubes
Using Fractional Delay Filters, Helsinki University of Technology,Dec.1995.
[17] J.A.Canny, Computational Approach to Edge Detector,IEEE Transac-tions on PAMI, pp679- 698, 1986.
[18] B.T.Krishna,Design of digital differentiators and integrators of order 1/2-World Journal of Modelling and Simulation,Vol.4, no.3, PP.182−187,2008.
[19] B.T.Krishna, Studies on fractional order differen- tiators and integrators:A survey,Elsevier signal processing, Vol.91,No.3, pp.386-426,2011.
[20] L.S.Davis, Edge detection techniques,Com- puter Graphics ImageProcess., Vol.4,pp.248-270, 1995.
[21] J.A.Canny, Computational Approach to Edge De- tector,IEEE Transac-tions on PAMI, pp.679- 698, 1986.
[22] W. J.Tompkins,Biomedical Digital Signal Pro- cessingC-LanguageExamples And Laboratory Experiments For The Ibm Pc, Prentice Hall,Up- per Saddle River, New Jersey-2000.
[23] Dobbs S.E, Schmitt N.M, Ozemek H.S,QRS de- tection by templatematching using real-time cor- relation on a microcomputer,Journal ofClinical Engineering ,1984,Vol.9,pp.197 - 212.