The linear analog circuit is described with the linear differential equation or with the Laplace transformation (s plane). For example: the RC circuit (low pass filter) is described with the first order differential equation:
or in the Laplace form:
The analog method experience can be used for the digital technical. The linear digital methods are used the difference equation and z transformation (z plane).
There are few transformation methods of the s-plane (analog space) to z-plane (digital space): backward Euler, impulse invariance, bilinear. The article is described the simple first order filter. Backward Euler method is suitable for the case.
Insert the (5) in the (2)
Then the z-transformation
And the difference equation
3. First Order Digital IIR Filter
The low pass IIR filter first order using the backward Euler (or impulse invariance) transformation is described with the (8) and (9).
Example of the A value calculation Sampling fs=20kHz Filter passband fb=1kHz
Then RC=1/(2πfb)=1/(2*3.14*1000Hz) ≈ 1.6e-4s Ts=1/fs=1/20000Hz=0.5e-4s A=Ts/(Ts+RC)=0.5e-4/(0.5e-4+1,6e-4) ≈ 0.24 y(n)=y(n-1)+0.24*(x(n)-y(n-1))
Notes 1. The value A is less as 1 => A < 1 2. The filter can be interpreted as weighting filter: y(n)=(1-A)y(n-1)+Ax(n). The input x(n) signal will be taken with wight A and previous history y(n-1) with the weight (1-A). If the input x(n) signal is not trusted then the value A shall be taken lower value. 3. The filter can be realized only with the one multiplication: y(n)=y(n-1)+A(x(n)-y(n-1) 4. IIR filter realization with fixed point arithmetic: output history y(n-1) shall be saved with the double accuracy
3.1 First Order Digital IIR Filter. Fixed Point Realization with the One Multiplication.
Fixed point realization shall be scaled. For example: input x and output y will be used signed 16 bits, scaling S=2^16 =0x10000=65536 and history Sy(n-1) will be saved signed 32 bits
Output value without scaling:
y(n) = Sy(n-1)+SA(x(n)-y(n-1) +/- 0.5*S)/S (11) where 0.5S is round value