Contents
Applet Description
The applet should clarify the properties of digital filters, whereby we confine ourselves to filters of the order M=2. Both non-recursive filters (FIR, Finite Impulse Response) as well as recursive filters (IIR, Infinite Impulse Response).
The input signal x(t) is represented by the sequence 〈xν〉 of its samples, where xν stands for x(ν·TA). The output sequence 〈yν〉is calculated, i.e. the discrete-time representation of the output signal y(t).
- TA denotes the time interval between two samples.
- We also limit ourselves to causal signals and systems, which means that xν≡0 and yν≡0 for ν≤0.
It should also be noted that we denote the initial sequence 〈yν〉 as
(1) the discrete-time impulse response 〈hν〉 if the “discrete-time Dirac function” is present at the input: 〈xν〉=〈1, 0, 0, 0, 0, 0, 0,...〉,
(2) the time-discrete step response 〈σν〉 if the “time-discrete step function” is present at the input: 〈xν〉=〈1, 1, 1, 1, 1, 1, 1,...〉,
(3) the discrete-time rectangle response 〈ρ(2,4)ν〉 if the “discrete-time rectangle function” is present at the input: 〈xν〉=〈0, 0, 1, 1, 1, 0, 0,...〉;
In quotation marks are the beginning of the ones (2) and the position of the last ones (4).
Theoretical background
General block diagram
Each signal x(t) can only be represented on a computer by the sequence 〈xν〉 of its samples, where xν stands for x(ν·TA).
- The time interval TA between two samples is limited by the sampling theorem.
- We limit ourselves here to causal signals and systems, which means that xν≡0 for ν≤0.
- In order to determine the influence of a linear filter with frequency response H(f) on the time-discrete input signal 〈xν〉, it is advisable to describe the filter discrete-time. In the time domain, this happens with the discrete-time impulse response 〈hν〉.
- On the right you can see the corresponding block diagram. The following therefore applies to the samples of the output signal 〈yν〉 thus holds:
- yν=M∑μ=0aμ⋅xν−μ+M∑μ=1bμ⋅yν−μ.
The following should be noted here:
- The index ν refers to sequences, for example at the input 〈xν〉 and output 〈yν〉.
- On the other hand, we use the index μ to identify the a and b filter coefficients.
- The first sum describes the dependency of the current output yν on the current input xν and on the M previous input values xν−1, ... , xν−M.
- The second sum indicates the influence of yν by the previous values yν−1, ... , yν−M at the filter output. It specifies the recursive part of the filter.
- The integer parameter M is called the order of the digital filter. In the program, this value is limited to M≤2.
Definitions:
(1) The output sequence 〈yν〉 is called the discrete-time impulse response 〈hν〉 if the “discrete-time Dirac function” is present at the input:
- 〈xν〉=〈1, 0, 0, 0, 0, 0, 0,...〉.
(2) The output sequence 〈yν〉 is called the time-discrete step response 〈σν〉 if the “time-discrete step function” is present at the input:
- 〈xν〉=〈1, 1, 1, 1, 1, 1, 1,...〉.
(3) The output sequence 〈yν〉 is called the discrete-time rectangle response 〈ρ(2,4)ν〉 if the “discrete-time rectangular function” is present at the input:
- 〈xν〉=〈0, 0, 1, 1, 1, 0, 0,...〉.
- The beginning of ones (2) and the position of the last ones (4) are given in single quotes.
Non-recursive filter ⇒ FIR–filter
Definition: If all feedback coefficients bμ=0 , one speaks of one non-recursive filter. In the English language literature, the term FIR filter (Finite Impulse Response) is also used for this.
The following applies to the order M applies:
- The output value yν depends only on the current and the previous M input values:
- yν=M∑μ=0aμ⋅xμ−ν.
- Time-discrete impulse response with 〈xν〉=〈1, 0, 0, 0, 0, 0, 0,...〉:
- 〈hμ〉=〈a0, a1, ..., aM〉.
Example 1: A two-way channel where
- the signal on the main path arrives undamped compared to the input signal but is delayed by 2 µs arrives with a delay, and
- at 4 µs distance – so absolutely at time t=6 µs – follows an echo with half the amplitude,
can be simulated by a non-recursive filter according to the sketch above, whereby the following parameter values must be set:
- M=3,TA=2µs,a0=0,a1=1,a2=0,a3=0.5.
Example 2: Consider a non-recursive filter with the filter coefficients a0=1,a1=2,a2=1.
(1) The conventional impulse response is: h(t)=δ(t)+2⋅δ(t−TA)+δ(t−2TA).
⇒ discrete-time impulse response: 〈hμ〉=〈1, 2, 1〉.
(2) The frequency response H(f) is the Fourier transform of h(t). By applying the displacement theorem:
- H(f)=2[1+cos(2π⋅f⋅TA)]⋅e−j2πfTA⇒H(f=0)=4.
(3) It follows that the time-discrete step response 〈σν〉 tends to become 4 for large ν.
(4) The discrete-time convolution of the input sequence ⟨xν⟩=⟨1,0,0,0,1,0,0,0,...⟩ with ⟨hν⟩=⟨1, 2, 1⟩ results
- ⟨yν⟩=⟨1,2,1,0,1,2,1,0,0,0,0,...⟩.
(5) The discrete-time convolution of the input sequence ⟨xν⟩=⟨1,1,0,0,1,0,0,0,...⟩ with ⟨hν⟩=⟨1, 2, 1⟩ results
- ⟨yν⟩=⟨1,3,3,2,2,1,0,0,0,0,0,...⟩.
Recursive filter ⇒ IIR filter
Definition:
- If at least one of the feedback coefficients is bμ≠0, then this is referred to as a recursive filter (see graphic on the right). The term IIR filter (Infinite Impulse Response) is also used for this, particularly in the English-language literature. This filter is dealt with in detail in the trial implementation.
- If all forward coefficients are also identical aμ=0 with the exception of a0, a purely recursive filter is available (see graphic on the left).
In the following we restrict ourselves to the special case “purely recursive filter of the first order”. This filter has the following properties:
- The output value yν depends (indirectly) on an infinite number of input values:
- yν=∞∑μ=0a0⋅b1μ⋅xν−μ.
- This shows the following calculation:
- yν=a0⋅xν+b1⋅yν−1=a0⋅xν+a0⋅b1⋅xν−1+b12⋅yν−2=a0⋅xν+a0⋅b1⋅xν−1+a0⋅b12⋅xν−2+b13⋅yν−3=....
- By definition, the discrete-time impulse response is the same as the output sequence if there is a single "one" at t=0 at the input.
- h(t)=∞∑μ=0a0⋅b1μ⋅δ(t−μ⋅TA)⇒〈hμ〉=〈a0, a0⋅b1, a0⋅b12 ...〉.
Conclusion: With a recursive filter, the (time-discrete) impulse response extends to infinity with M=1:
- For reasons of stability, b1<1 must apply.
- With b1=1 the impulse response h(t) would extend to infinity and with b1>1 the variable h(t) would even continue to infinity.
- With such a recursive filter of the first order, each individual Dirac line is exactly the factor b1 smaller than the previous Dirac line:
- hμ=h(μ⋅TA)=b1⋅hμ−1.
Example 3: The graphic opposite shows the discrete-time impulse response 〈hμ〉 of a recursive filter of the first order with the parameters a0=1 and b1=0.6.
- The (time-discrete) course is exponentially falling and extends to infinity.
- The ratio of the weights of two successive Diracs is b1=0.6.
Recursive filter as a sine generator
The graphic shows a second-order digital filter that is suitable for generating a time-discrete sine function on a digital signal processor (DSP) if the input sequence ⟨xν⟩ a (time-discrete) Dirac function is:
- ⟨yν⟩=⟨sin(ν⋅TA⋅ω0)⟩.
The five filter coefficients result from the: Z transformation:
- Z{sin(νTA⋅ω0)}=z⋅sin(ω0⋅TA)z2−2⋅z⋅cos(ω0⋅TA)+1.
After implementing this equation using a second-order recursive filter, the following filter coefficients are obtained:
- a0=0,a1=sin(ω0⋅TA),a2=0,b1=2⋅cos(ω0⋅TA),b2=−1.
- The filter coefficients a0 and a2 can be omitted and b2=−1 has a fixed value.
- The angular frequency ω0 of the sine wave is therefore only determined by a0 and a0.
Example 3: Let a1=0.5, b1=√3, x0=1 and xν≠0=0.
(1) Then the following applies to the initial values yν at times ν≥0:
- y0=0;
- y1=0.5 ⇒ the „1” at the input only has an effect at time ν=1 because of a0=0 at the output;
- y2=b1⋅y1−y0=√3/2≈0.866 ⇒ with ν=2 the recursive part of the filter also takes effect;
- y3=√3⋅y2−y1=√3⋅√3/2−1/2=1 ⇒ for ν≥2 the filter is purely recursive: yν=b1⋅yν−1−yν−2;
- y4=√3⋅y3−y2=√3⋅1−√3/2=√3/2;
- y5=√3⋅y4−y3=√3⋅√3/2−1=0.5;
- y6=√3⋅y5−y4=√3⋅1/2−√3/2=0;
- y7=√3⋅y6−y5=√3⋅0−1/2=−0.5.
(2) By continuing the recursive algorithm one gets for large ν–values: yν=yν−12 ⇒ T0/TA=12.
Exercises
- First select the number 1 ... 10 of the task to be processed.
- A task description is displayed. The parameter values are adjusted.
- Solution after pressing "sample solution".
- The number 0 corresponds to a "reset": Same setting as when the program was started.
(1) The filter coefficients are a0=0.25, a1=0.5, a2=0.25, b1=b2=0. Which filter is it?
Interpret the impulse response 〈hν〉, the step response 〈σν〉 and the rectangular response 〈ρ(2,8)ν〉 each in a time-discrete representation.
- Due to the missing b coefficients, it is a non-recursive digital filter ⇒ FIR filter (Finite Impulse Response).
- The impulse response consists of M+1=3 Dirac lines according to the a coefficients: 〈hν〉=〈a0, a1, a2〉=〈0.25, 0.5, 0.25, 0, 0, 0,...〉.
- The step response is: 〈σν〉=〈0.25, 0.75, 1, 1, 1, 1,...〉. The final value is equal to the DC signal transfer factor H(f=0)=a0+a1+a2=1.
- The distortions with rise and fall can also be seen from the rectangular response 〈ρ(2,8)ν〉=〈0, 0,0.25, 0.75, 1, 1, 1, 1, 1, 0.75, 0.25, ...〉.
(2) How do the results differ with a2=−0.25?
- Taking into account H(f=0)=0.5 there are comparable consequences ⇒ Step response: 〈σν〉=〈0.25, 0.75, 0.5, 0.5, 0.5, 0.5,...〉.
(3) Now let the filter coefficients a0=1, b1=0.9 and a1=a2=b2=0. Which filter is it? Interpret the impulse response 〈hν〉.
- It is a recursive digital filter ⇒ IIR filter (Infinite Impulse Response) of the first order. It is the discrete-time analogue of the RC low pass.
- Starting from h0=1 is h1=h0⋅b0=0.9, h2=h1⋅b0=b20=0.81, h3=h2⋅b0=b30=0.729, and so on ⇒ 〈hν〉 extends to infinity.
- Impulse response h(t)=e−t/T with T: intersection (Tangente bei t=0, Abscissa) ⇒ hν=h(ν⋅TA)=e−ν/(T/TA) with T/TA=1/(h0−h1)=10.
- So: The values of the continuous time differ from the discrete-time impulse response. This results in the values 1.0, 0.9048, 0.8187 ...
(4) The filter setting is retained. Interpret the step response 〈hν〉 and the rectangular response 〈ρ(2,8)ν〉. What is the value for H(f=0)?
- The step response is the integral over the impulse response: σ(t)=T⋅(1−e−t/T)] ⇒ σν=10⋅(1−e−ν/10) ⇒ σ0=1, σ1=1.9, σ2=2.71, ...
- For large ν values, the (time-discrete) step response tends to the DC signal transmission factor H(f=0)=10: σ40=9.867, σ50=9.954, σ∞=10.
- The rectangular response 〈ρ(2,8)ν〉 increases with a delay of 2 in the same way as 〈σν〉. In the area ν≥8 the ρν values decrease exponentially.
(5) We continue to consider the filter with a0=1, b1=0.9, a1=a2=b2=0. What is the output sequence 〈yν〉 for the input sequence 〈xν〉=〈1, 0, −0.5〉?
Note: The task can also be solved with this program, although the constellation considered here cannot be set directly.
- You can help yourself by setting the coefficient a2=−0.5 and reducing the input sequence to 〈xν〉=〈1, 0, 0, ...〉 ⇒ „Dirac function”.
- The actual impulse response of this filter (with a2=0) was determined in task (3): h0=1, h1=0.9, h2=0.81, h3=0.729, h4=0.646.
- The solution to this problem is: y0=h0=1, y1=h1=0.9, y2=h2−h0/2=0.31, y3=h3−h1/2=0.279, y4=h4−h2/2=0.251.
- Caution: Step response and rectangular response now refer to the fictitious filter (with a2=−0.5) and not to the actual filter (mit a2=0).
(6) Consider and interpret the impulse response and the step response for the filter coefficients a0=1, b1=1, a1=a2=b2=0.
- The system is unstable: A time-discrete Dirac function at input (at time t=0) causes an infinite number of Diracs of the same height in the output signal.
- A discrete-time step function at the input causes an infinite number of Diracs with monotonically increasing weights (to infinity) in the output signal.
(7) Consider and interpret the impulse response and step response for the filter coefficients a0=1, b1=−1, a1=a2=b2=0.
- In contrast to exercise (6), the weights of the impulse response 〈hν〉 are not constantly equal to 1, but alternating ±1. The system is also unstable.
- With the jump response 〈σν〉, however, the weights alternate between 0 (with even ν) and 1 (with odd ν).
(8) We consider the „sine generator”: a1=0.5, b1=√3=1.732, b2=−1. Compare the impulse response with the calculated values in Beispiel 4.
How do the parameters a1 and b1 influence the period duration T0/TA and the amplitude A of the sine function?
- 〈xν〉=〈1,0,0,...〉 ⇒ 〈yν〉=〈0,0.5,0.866,1,0.866,0.5,0,−0.5,−0.866,−1,−0.866,−0.5,0,...〉 ⇒ sine, period T0/TA=12, amplitude 1.
- The increase/decrease of b1 leads to the larger/smaller period T0/TA and the larger/smaller amplitude A. b1<2 must apply.
- a1 only affects the amplitude, not the period. There is no value limit for a1. If a1 is negative, the minus sine function results.
- Is there no discrepancy to h(t) continuous value???
(9) The basic setting is retained. Which a1 and b1 result in a sine function with period T0/TA=16 and amplitude A=1?
- Trying with b1=1.8478 actually achieves the period duration T0/TA=16. However, this increases the amplitude to A=1.307.
- Adjusting the parameter a1=0.5/1.307=0.3826 then leads to the desired amplitude A=1.
- Or you can calculate this as in the example: b1=2⋅cos(2π⋅TA/T0)=2⋅cos(π/8)=1.8478, a1=sin(π/8)=0.3827.
(10) We continue with the "sine generator". What modifications do you have to make to generate a "cosine"?
- With a1=0.3826, b1=1.8478, b2=−1 and 〈xν〉=〈1,1,1,...〉 is the output sequence 〈yν〉 the time-discrete analog of the step response σ(t).
- The step response is the integral over sin(π⋅τ/8) within the limits of τ=0 to τ=t ⇒ σ(t)=−8/π⋅cos(π⋅τ/8)+1.
- If you change a1=0.3826 on a1=−0.3826⋅π/8=0.1502, then σ(t)=cos(π⋅τ/8)−1 ⇒ Values between 0 and −2.
- Would you still in the block diagram zν=yν+1 add, then zν a time-discrete cosine curve with T0/TA=16 and A=1.
Applet Manual
About the authors
This interactive calculation tool was designed and implemented at the chair for communications engineering at the Technische Universität München.
- The first version was created in 2005 by Bettina Hirner as part of her diploma thesis with “FlashMX – Actionscript” (Supervisor: Günter Söder).
- In 2020 the program was redesigned by Andre Schulz (Bachelor thesis LB, Supervisors: Benedikt Leible and Tasnád Kernetzky ) via „HTML5”.