Basic DSP Theory
5.5 Evaluating the Transfer Function H(v)
DSP fi lter transfer functions will contain e 2jvn terms that need to be evaluated over the range of 0 to p; the way to do this is by using Euler’s equation to decompose the sinusoid into its real (cos) and imaginary (sin) components. Then, evaluate the cos and sin terms at the frequency in question. In the last chapter you manually calculated the input/output relationship of a fi lter by cranking through the fi lter operation, one step at a time. In this improved method, you only need to solve the transfer function equation. Start with the block diagram in Figure 5.11 .
The transfer function is as follows:
H(v) 5 a01 a1e2 jv1 (5.15 )
Figure 5.10: Mapping the 0 to 2p range of frequencies across the 0 to fs range.
To evaluate the transfer function, let v vary from 0 to p and get the first half of the response.
The other half is a mirror image of the data.
a0
Σ
x(t)
-jωl
e
a1
y(t)
Use the fi lter coeffi cients a 0 5 0.5, a 1 5 0.5. You can use Table 5.1 to help with the evaluation. Evaluate at the following frequencies:
• DC: 0
• Nyquist: p
• ½ Nyquist: p/2
• ¼ Nyquist: p/4
Evaluation is a two-step process for each frequency:
1. Use Euler’s equation to convert the e terms into real and imaginary components.
2. Find the magnitude and argument of the complex equation.
5.5.1 DC (0 Hz)
H(v) 5 0.5 1 0.5e2 jv1
5 0.5 1 0.5(cos(v) 2 jsin(v))
5 0.5 1 0.5(cos(0) 2 jsin(0)) (5.16)
5 0.5 1 0.5(1 2 j0) 5 1.0 1 j0
Figure 5.11: First-order feed-forward block diagram.
Table 5.1: Sine and cosine function evaluations at DC, ¼ Nyquist,
½ Nyquist, ¾ Nyquist, and Nyquist.
Frequency v cos(v) sin(v)
0 1.0 0.0
p/4 0.707 0.707
p/2 0.0 1.0
3p/4 0.707 20.707
p 21.0 0.0
Output
-1.0 +1.0 + 1.0
-1.0
Input
Find the magnitude and phase at this frequency:
0 H(v) 0 5 "(a 1 jb)(a 2 jb) 5"(1 1 j0)(1 2 j0) 5 1.0
Arg(H) 5 tan21(b/a) 5 tan2 1(0/1)
(5.17)
5 0.0+
Compare these mathematical results ( Equations 5.16 and 5.17 ) with the graphical ones from the last chapter ( Figure 5.12 ).
5.5.2 Nyquist (p)
H(v) 5 0.5 1 0.5e2 jv1
5 0.5 1 0.5(cos(v) 2 jsin(v))
5 0.5 1 0.5(cos(p) 2 jsin(p)) (5.18)
5 0.5 1 0.5(21 2 j0) 5 0 1 j0
0 H(v) 0 5 "(a 1 jb)(a 2 jb) 5"(0 1 j0)(0 2 j0)
5 0.0 (5.19)
Arg(H) 5 tan2 1(b/a) 5 tan2 1(0/0)
5 0+
Figure 5.12: The graphical results show the same information. The magnitude is 1.0 and the phase shift is 0.
+ 1.0
-1.0 -1.0
Input
+1.0
Output
The inverse tangent argument is 0/0 and the phase or Arg(H) is defi ned to be 0 under this condition. The C11 function you use is arctan2 ( im,re ), which performs the inverse tangent function; it will also evaluate to 0 in this case. Now, compare our results to the last chapter’s graphical results ( Figure 5.13 ).
5.5.3 ½ Nyquist (p/2)
H(v) 5 0.5 1 0.5e2 jv1
5 0.5 1 0.5(cos(v) 2 jsin(v))
5 0.5 1 0.5(cos(p/2) 2 jsin(p/2)) (5.20)
5 0.5 1 0.5(0 2 j1)
5 0.5 2 j0.5
0 H(v) 0 5 "(a 1 jb)(a 2 jb) 5"(0.5 1 j0.5)(0.5 2 j0.5) 5"0.25 1 0.25 5 "0.5 5 0.707
Arg(H ) 5 tan2 1(b/a)
(5.21)
5 tan2 1(20.5/0.5)
5 245+
Compare this to the last chapter’s graphical results ( Figure 5.14 ); the magnitude is 0.707 with a phase shift of 245 degrees, and the results agree.
5.5.4 1/4 Nyquist (p/4)
H(v) 5 0.5 1 0.5e2 jv1 (5.22)
5 0.5 1 0.5(cos(v) 2 jsin(v))
Figure 5.13: The graphical results show the same information at Nyquist—the magnitude is 0 and there is no phase shift since there is nothing there to shift.
Output Input + 1.0
-1.0
Phase Shift + 1.0
Time Smearing
-1.0
5 0.5 1 0.5(cos(p/4) 2 jsin(p/4)) 5 0.5 1 0.5(0.707 2 j0.707)
5 0.853 2 j0.353
0 H(v) 0 5 "(a 1 jb)(a 2 jb)
5"(0.853 1 j0.353)(0.853 2 j0.353) 5"0.728 1 0.125 5 "0.853
5 0.923 Arg(H ) 5 tan2 1(b/a)
(5.23)
5 tan2 1(20.353/0.853)
5 222.5+
Compare to the last chapter’s graphical results ( Figure 5.15 ); you can see how much more accuracy we get with the mathematical calculation. The magnitude and phase shift look about right when compared to the graphs.
Now, you can combine all the evaluations together and sketch out the frequency response of the fi lter ( Figure 5.16 ).
Figure 5.14: Graphical results from the last chapter at ½ Nyquist.
+1.0
Input
-1.0
Phase Shift
+1.0
Time Smearing
Output
-1.0
Magnitude 1.0 0.9
0.7
0.0
Phase 0°
-45°
-90°
1/4 Nyquist fs/8
½ Nyquist fs/4
Nyquist fs/2
Angle Frequency
Figure 5.15: Graphical results from the last chapter at ¼ Nyquist.
Figure 5.16: The fi nal composite frequency and phase response plots show the same results as the last chapter, but with a lot less work.
+π π/4 j0.707
π/4 π/2 Im
3 π / 4
0Hz 0.707 Re
R = 1
Table 5.2: The magnitude and angle of e jv from DC to Nyquist.
Frequency p e jv = cos(v) 1 jsin(v) | e jv | Arg(e jv)
DC (0Hz) 1 1 j0 1.0 0
¼ Nyquist 0.707 1 j0.707 1.0 p/4
½ Nyquist 0 1 j1 1.0 p/2
Nyquist 21 1 j0 1.0 p
Figure 5.17: The positive frequencies map to the upper half of the unit circle.
Hopefully, this quick example has convinced you that it is better to do a little complex math than have to analyze and design these fi lters by brute force analysis of time domain input sequences.
5.6 Evaluating e
jvIn the evaluation of the transfer function, you had to substitute values of v from 0 to p into the e jv terms of the equation. But what would the plot look like if you evaluate a single e jv term? You saw that the use of Euler’s equation produced the real and imaginary components of the term and now it’s time to plot them over the range of 0 to p.
If you evaluate e jv over more frequencies and plot the resulting values in the complex plane, you get an interesting result. The frequencies in Table 5.2 from 0 to 1p map to an arc that is the top half of a circle with radius 5 1.0, shown in Figure 5.17 . Remember, the magnitude is the radius and the argument is the angle when using polar notation, which simplifi es the
Im
-π/2
- π / 4 0Hz Re -π
- 3 π / 4
analysis. You don’t have to keep track of the real and imaginary parts. The evaluation at v 5 p/4 is plotted on the curve. The circle this arc is laying over would have a radius of 1.0 and is called the unit circle . If you evaluate e jv over the negative frequencies that correspond to 0 to 2p, you get a similar but inverted table ( Table 5.3 ).
This table translates to a mapping across the lower half of the same unit circle ( Figure 5.18 ).
The negative frequencies increase as you move clockwise from 0 Hz, the radius stays 1.0 during the entire arc.
Why bother to evaluate e jv ? It will be useful very soon when we start picking apart the transfer functions in an effort to fi gure out how to design fi lters. It also shows the limited
“frequency space” of the digital domain. All the frequencies that could exist from 2Nyquist to 1Nyquist map to outline of a simple unit circle. In contrast the analog domain has an infi nitely long frequency axis and an infi nite frequency space.
Table 5.3: The magnitude and angle of e jv from DC to 2Nyquist.
Frequency v e jv 5 cos(v) 1 jsin(v) | e jv | Arg(e jv)
DC (0Hz) 1 1 j0 1.0 0
2¼ Nyquist 0.707 2 j0.707 1.0 2p/4
2½ Nyquist 0 2 j1 1.0 2p/2
2Nyquist 21 1 j0 1.0 2p
Figure 5.18: The negative frequencies map to the lower half of the unit circle.