Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:
-
Upload
beatrice-carpenter -
Category
Documents
-
view
221 -
download
1
Transcript of Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:
![Page 1: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/1.jpg)
Digital Filters
![Page 2: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/2.jpg)
A/D Computer D/A
x(t) x[n] y[n] y(t)
].[]1[][ nxnyny Example:
![Page 3: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/3.jpg)
To get the current output y[n], which is sent to the D/A, we get the previous output y[n-1] (sent the last time to the D/A) and add to it the current input from the A/D. In a programming language like C++, the code would look something like this:
yp = 0; // set “previous” y to zerowhile (true){ x = inp(ad); // get new sample y = yp+x; // perform filtering operation outp(y, da); // send filtered sample to D/A yp = y; // set “current” to “previous”
// for next iteration}
![Page 4: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/4.jpg)
).(1)(
].[]1[][
].[]1[][
1 zXzzY
nxnyny
nxnyny
Finding the z-transform transfer function:
.1
1
)(
)()(
1
zzX
zYzH
![Page 5: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/5.jpg)
Now what does this operation do to an input signal?
Example: find the impulse and step responses to the previous filter.
Solution: we could use z-transforms or convolution to find the output when the input is an impulse or a step, but instead, let us see how the output “evolves.” A table will be created with three columns: n, x[n] and y[n]. Each column will correspond to an instance in discrete-time. For the impulse input x[n]=[n] we have
![Page 6: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/6.jpg)
n x[n]=[n] y[n]
0 1 1
1 0 1
2 0 1
3 0 1
4 0 1
![Page 7: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/7.jpg)
For the step input x[n]=u[n] we have
n x[n]=u[n] y[n]
0 1 1
1 1 2
2 1 3
3 1 4
4 1 5
![Page 8: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/8.jpg)
The plots of these outputs are as follows:
1 2 3 4n
y[n] for x[n]=[n]
![Page 9: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/9.jpg)
1 2 3 4n
y[n] for x[n]=[n]
2
4
3
1
5
![Page 10: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/10.jpg)
Example: Find the impulse response and the step response for the following transfer function:
.1
1)(
121
z
zH
Solution: From the definition of the transfer function we have
.1
1
)(
)(1
21
zzX
zY
![Page 11: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/11.jpg)
Cross-multiplying and converting back to discrete-time domain we have
].[]1[][
].[]1[][
).(1)(
21
21
121
nxnyny
nxnyny
zXzzY
In other words, the current output is equal to one-half times the previous output plus the current input.
![Page 12: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/12.jpg)
n x[n]=[n] y[n]
0 1 1
1 0
2 0
3 0
4 0
21
41
81
161
![Page 13: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/13.jpg)
For the step input x[n]=u[n] we have
n x[n]=u[n] y[n]
0 1 1
1 1
2 1
3 1
4 1
211
431
871
16151
![Page 14: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/14.jpg)
The plots of these outputs are as follows:
1 2 3 4n
y[n] for x[n]=[n]
![Page 15: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/15.jpg)
1 2 3 4n
y[n] for x[n]=[n]
1
2
![Page 16: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/16.jpg)
The step and impulse functions for this transfer function look like those for an RC low-pass filter.
Suppose that we wished to construct a digital filter corresponding to an RC low-pass filter?
Can we convert an analog filter to a digital filter?
![Page 17: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/17.jpg)
The Matched z-Transform
In the matched z-transform digital filter design method we try to “match” the impulse response of the analog filter with that of the digital filter being designed.
To match the impulse responses, we take the inverse Laplace transform of the analog filter H(s)h(t), then sample the impulse response h(t)h[n], then take the z-transform of the sampled impulse response to get the z-transform transfer function h[n]H(z).
![Page 18: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/18.jpg)
)(sH
)(th ][nh
)(zH
L-1 Z
Once we have our z-transform transfer function H(z), we apply the definition of the transfer function to write our digital filter equations:
.)(
)()(
zX
zYzH
sample
Analog Prototype Digital Filter
![Page 19: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/19.jpg)
Example: Use the matched filter design method to design the digital equivalent of an integrator.
Solution: The analog transfer function is
.1
)(s
sH
The inverse Laplace transform is
).()( tuth
![Page 20: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/20.jpg)
We then sample the impulse response to get h[n]:
].[][ nunh
Finally, we take the z-transform of the impulse response to get the digital filter transfer function.
.1
1)(
1
zzH
![Page 21: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/21.jpg)
Finally, we apply the definition of the z-transform transfer function to get the relationship between the input of the digital filter x[n] and the output of the digital filter y[n].
.1
1
)(
)()(
1
zzX
zYzH
).(]1)[( 1 zXzzY
].[]1[][ nxnyny
![Page 22: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/22.jpg)
].[]1[][ nxnyny
Applying this formula to an arbitrary input x[n], we have
n x[n] y[n]
0 x[0] x[0]
1 x[1] x[0]+x[1]
2 x[2] x[0]+x[1]+x[2]
3 x[3] x[0]+x[1]+x[2]+x[3]
![Page 23: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/23.jpg)
We see that the output is the summation of the input. Thus the digital filter accurately represents the analog filter.
The digital filter does not always accurately represent the analog filter as will be seen in the next example.
![Page 24: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/24.jpg)
Example: Use the matched filter design method to design the following transfer function:
,1
1)(
c
ssH
where c = s/4, and s is the sampling frequency.
Solution: First, we find the impulse response
.)( tc
ceth
![Page 25: Digital Filters. A/DComputerD/A x(t)x[n]y[n]y(t) Example:](https://reader030.fdocuments.in/reader030/viewer/2022032722/56649cdb5503460f949a5cbe/html5/thumbnails/25.jpg)
Then we sample the impulse response:
.][ 2/nc
nTc eenh c
Then we take the z-transform of the (discrete-time) impulse response:
.1
)(12/
zezH c