Damped Oscillators (revisited) We saw that damped oscillators can be modeled using a recursive filter with two coefficients and no feedforward components: Y(k) = - a(1)*y(k-1) - a(2)*y(k-2) We derived approximations for a(1) and a(2), as a function of oscillator parameters a(1) = -2+b-(k/m) 1+b a(2) = 1 1+b Where b is the damping constant, k is the spring constant and m is the mass
Deriving exact parameter values for damped oscillators as digital resonators mẍ + bẋ + kx =0 The full solution x = e bw 2 t e jωt where: ω 2 = k m e bw 2 t bw = b m
Example resonator Y(k) = X(k) -a(1)y(k-1) - a(2)y(k-2) Choose, a(1) = -1.287 and a(2)=.8282 Impulse Response
Transfer Functions for Digital Resonators In general, the transfer function of a digital resonator can be obtained from the expression in (2) (2) H(z) = b(1). 1+ a(1)z -1 + a(2)z -2 Note that this is just a special case of the general equation (9) where M=1 and L=2. H(z) = b(1) + b(2)z -1 +... + b(m)z -(M-1). 1+ a(1)z -1 +... + a(l)z -L
Resonator Amplitude Response Y(k) = X(k) + 1.287 *Y(k-1) - 0.8282*Y(k-2)
Frequency and Bandwidth Looking again at the transfer function of a digital resonator... H(z) = b(1). 1+ a(1)z -1 + a(2)z -2... one can see that the three coefficients determine the behavior of a particular resonator (they are the only variables)... How can we derive frequency and bandwidth, terms of a(1) and a(2) (and conversely) in a more general way than our approximation of last week?
Roots of the Denominator We have seen that when the numerator of the transfer function gets close to 0, then the value of the entire transfer function becomes 0. This was called, not surprisingly, a zero of the transfer function. (2) H(z) = b(1). 1+ a(1)z -1 + a(2)z -2 There are certain values of z for which the expression in the denominator of (2) will be zero (the roots of that polynomial). As the denominator gets close to 0, the transfer function becomes very large. This is the compliment of a zero in the transfer function... it is called a pole
Finding the Roots We can calculate the frequency and bandwidth of a digital resonator if we know the value of θ (the angle) and R (the magnitude) for the roots. First, we need to find the roots. A quadratic equation (a second order polynomial), given in (6), has roots given in (7): (6) ax 2 + bx + c = 0 (7) x = -b ± b 2-4ac. 2a
Finding the Roots (cont.) The denominator in (2) looks similar to (6), but with negative powers of z instead of positive powers. We can remedy this by multiplying the numerator and denominator of (2) by z 2, giving (8) (2) H(z) = b(1). 1+ a(1)z -1 + a(2)z -2 (6) ax 2 + bx + c = 0 (8) H(z) = b(1)z 2. z 2 + a(1)z + a(2)
Finding the Roots (cont.) Now we can use the quadratic formula to solve for the roots of the denominator of (8), where a=1, b=a(1) and c=a(2) (8) H(z) = b(1)z 2. z 2 + a(1)z + a(2) (7) z = -b ± b 2-4ac. 2a
Real and Complex Roots There are two cases to consider: CASE 1: b 2-4ac 0, roots are on the real axis Resonant frequencies = 0, π CASE 2: b 2-4ac < 0, complex roots Real part = -b 2a Imag part = ± -b 2 + 4ac 2a
Real and Complex Roots (cont.) Now substituting the coefficients we saw before, i.e., a = 1, b = a(1), c = a(2) Real part = -a(1) 2a Imag part = ± -a(1) 2 + 4a(2) 2
Visualizing the Poles Remember that we could visualize the zeros of the transfer function as points in the complex plane. It is helpful to do this with the poles, as well: We can describe them as real (horizontal) and imaginary (vertical) values We can also describe them in terms of the value of θ (the angle) and R (the magnitude). Roots always come in complex conjugate pairs Numbers with equal real parts, and imaginary parts differing only in sign R R θ -θ
Calculating R Now we know that the magnitude squared (R 2 ) of a complex number is equal to the sum of the real part squared plus the imaginary part squared: ( ) ( ) R 2 = -a(1) 2 + -a(1) 2 + 4a(2) 2 2 2 R 2 = a(1) 2 + -a(1) 2 + 4a(2) 4 4 R 2 = 4a(2) 4 R = a(2)
Calculating θ If we know R and the Real part, we can also then derive θ: cos θ = Real part R cos θ = -a(1) 2R cos θ = -a(1) 2 a(2) θ = arccos ( -a(1) ) 2 a(2)
Rewriting Poles and H(z) The roots will, in general, be complex and we can now calculate R and θ. Thus, it is useful to rewrite the poles in the form: zn = Rne jθ n Hence, we can rewrite the transfer function as: (4) H(z) = b(1). (z - R1e jθ 1) (z - R2e jθ 2) Since θ1 = θ2, the roots are complex conjugates, and can be written, more simply, as: (5) H(z) = b(1). (z - Re jθ ) (z - Re -jθ )
Resonator Frequency What can we learn about the frequency response of a resonator from the location of the poles in the complex plane? The frequencies (points on the unit circle) closest to the poles are those for which ω = θ, ω = -θ R R θ -θ Frequencies are points around the unit circle The closer a frequency is to a pole, the larger its response
Resonator Frequency (cont.) Angle of pole (π/4 radians) is the frequency that has the greatest amplitude response θ θ = π/4 radians
Resonator Bandwidth The magnitude of the roots, R, is related to the bandwidth of the resonator. The closer a frequency (point on the unit circle) is to the pole, the greater that frequency s amplitude response. When R is close to 1 (narrow bandwidth), the resonance frequency (red dot) is much closer to the pole than are nearby non-resonance frequencies (black dots). When R is small (wide bandwidth), the resonance is not much closer to the pole than the non-resonances are. Narrow Bandwidth Broad Bandwidth
Understanding poles (cont.) What happens when R is large enough to put the pole outside the unit circle? a = [1-1.5 1.1]; The exponentially decreasing amplitude of the oscillator becomes positive, and we have something that grows.
Calculating ω and bw ω = θ R 2 = e -bw geometric relation between R and bw We showed that R = a(2) a(2) = e -bw log(a(2)) = -bw bw = -log(a(2))
Calculating the Coefficients We may need to reverse this process, and calculate the resonator coefficient, a(2), from the bandwidth (bw). First, we have to convert BW in Hz to bw in radians/sample: bw = BW 2π. srate Then we just rearrange this equation, which we just found... bw = -ln(a(2))...solving for the coefficients this time: a(2) = e -bw
Calculating the Coefficients We can do a similar thing to calculate the other resonator coefficient, a(1), from ω. So, first convert from f in Hz to ω in radians/sample: We know that θ= ω. ω = f 2π. srate Then we just rearrange this previous equation... θ = arccos ( -a(1) ) 2 a(2)...and solve for the coefficients: a(1) = 2 a(2) cosθ