unit2sup - University of Kentucky

advertisement
EE513
Audio Signals and Systems
Complex Oscillator
Kevin D. Donohue
Electrical and Computer Engineering
University of Kentucky
Oscillator Design
Marginally Stable approach: Design a system by placing
poles so that a marginally stable system results, which
oscillates with a fundamental frequency of f0 when excited
by a unit impulse.
Show that TF and difference equation of oscillator system are
given by:
K
Hˆ ( z ) 
1  2 cos( ) z 1  z 2
y[n]  2 cos( ) y[n  1]  y[n  2]  Kx[n]
where K scales the input to control the amplitude of
oscillations, and  controls the frequency of oscillation fo ,
and sampling frequency fs by:
2f o

fs
Oscillator Design
Trig-Identity Approach: Design a system by selecting
values of A and B in the trig-identity below so that y[n] can
substitute out the cos(nT0) function (T is sampling period)
and result in a second order autoregressive difference
equation.
cos(A  B)  cos(A  B)
cos(A) cos(B) 
2
Show that difference equation of oscillator system is given
by:
y[n]  2 cos(T ) y[n  1]  y[n  2]
0
Oscillator is initiated with non-zero initial conditions. For
n=0, let
y[1]  K cos(T0 ),
0  2f 0 , T 
1
fs
y[2]  K cos(2T0 )
Analyze Design
Consider Z transform of general second order system:
y[n]  a1 y[n  1]  a2 y[n  2]  Kx[n]
Show that Z transform can be expressed as:
Yˆ ( z ) 
KXˆ ( z ) z 2
z  a1 z  a 2
2
Input term
1

y[1](a1 z 2  a 2 z1 )  y[2](a 2 z 2 )
z 2  a1 z1  a 2
Initial condition term
Multiple Frequency Oscillator
Excite a bank of oscillators (in parallel) tuned to different
frequencies
M
Km
1
2
m 1 1  2 cos( m ) z  z
Hˆ ( z )  
Each term represents a separate difference equation (second
order system) where their outputs can be added together:
y[n]  y1[n]  y2 [n]   yM [n]
y1[n]  2 cos(1 ) y1[n  1]  y1[n  2]  K1 x[n]
y2 [n]  2 cos( 2 ) y2 [n  1]  y2 [n  2]  K 2 x[n]

yM [n]  2 cos( M ) yM [n  1]  yM [n  2]  K M x[n]
Multiple-Frequency Oscillator
To obtain a direct form implementation for use with the filter
function in Matlab, each parallel term must be combined to
obtain a higher order, but single term transfer function
1
2
2 ( M 1)
b

b
z

b
z



b
z
K
0
1
2
2
(
M

1
)
m
Hˆ ( z )  

1
2
 a2,m z
1  a1 z 1  a2 z 2  a3 z 3    a2 M z 2 M
m 1 1  a1, m z
M
The numerator and denominator coefficients can be used
directly in the direct-form I or II implementation of a
complex (multiple-frequency) oscillator. The left hand side
represents a parallel implementation.
See Matlab functions residuez, filter, fdatool, dfilt
Direct Form I Implementations
Direct form I implementation of an IIR filter. The square blocks
represent unit delays, the triangles represent multiplies, and the circles
represent accumulators. The variable w[n] is an intermediate value output
from the all-zero component and the input to the all-pole component of
the filter, as suggested by the factorization in the equation.
x[n]
w[n]
b0
z-1
z-1
M
 m 


bm z

  bm z 

1
m 0
m 0
ˆ
H ( z) 



N
N
n
n
1

 a0   an z 
a0   an z
n 1


n 1

Yˆ ( z ) Wˆ ( z ) Yˆ ( z )


ˆ
X ( z ) Xˆ ( z ) Wˆ ( z )
M
-a1
b1
m
z-1

y[n]
1/a0

bM-1



z-1

-aN1
z-1
z-1
bM
-a2
Direct Form II Implementation
Direct form II implementation of an IIR filter. Note:
1. The difference from direct form I is that the input and w[n] are
associated with the all-pole component of the filter while the output and
w[n] are associated with the all-zero part as suggested by the equation
below.
• 2. The filter coefficients are the same for either direct form I or II
implementations.
x[n]

 b z m 

  m 
1
m 0
ˆ
H ( z) 

 m0

N
N
n
n
1
 a0   an z 

a0   an z
n 1

n 1


Yˆ ( z ) Wˆ ( z ) Yˆ ( z )


ˆ
X ( z ) Xˆ ( z ) Wˆ ( z )
M
b
m
z m
y[n]
w[n]
G0
1/a0
b0
z-1
M
-a1


b1




z-1
-aN
bM
Cascade Implementation
From a direct form implementation a cascaded series of
second order filters can be also be derived for another
implementation of second order systems. Note in this case the
coefficient are no longer the same as for the direct form
implementations.
ˆ1 ( z ) Wˆ2 ( z )
ˆ ( z)
K
W
Y
m
Hˆ ( z )  

...
1
2
ˆ
ˆ
 a2,m z
m 1 1  a1, m z
X ( z ) W1 ( z ) WˆM 1 ( z )
M
 b00  b10 z 1  b20 z 2  b01  b11 z 1  b21z 2   b0 M  b1M z 1  b2 M z 2 


...

1
 2 
1
2  
1
2 
 1  a10 z  a20 z  1  a11z  a21z   1  a1M z  a2 M z 
In Matlab see method convert and sos and filter for dfilt, and
tf2sos, sos2tf.
Parallel Implementation
A parallel bank of second order filters can be also be derived
(obtained directly from the oscillator design procedures
described in these notes). Note in this case the coefficient are
not the same as in the direct form or cascade
implementations.
Km
Wˆ1 ( z ) Wˆ2 ( z )
WˆM ( z )


 ... 
1
2
ˆ
ˆ
 a2 ,m z
m 1 1  a1, m z
X ( z) X ( z)
Xˆ ( z )
M
Hˆ ( z )  
 b00  b10 z 1  b20 z 2   b01  b11z 1  b21 z 2 
 b0 M  b1M z 1  b2 M z 2 

  
  ...  

1
2 
1
2 
1
2 
 1  a1M z  a2 M z 
 1  a10 z  a20 z   1  a11 z  a21 z 
In Matlab see method convert and parallel for dfilt.
Download