Professional Documents
Culture Documents
Processing
Lecture 7- Concept of filtering
IVAN TANRA
What is filter ?
Filter is a device or process that removes some unwanted components or features
from a signal
Filter normally in the form of analog (RC circuit) or digital (digital signal
processing/microprosseor))
𝑓𝑐
𝑓𝑐
𝐻 ( 𝜔 )=
{ 1 𝑓 ≤| 𝑓 𝑐|
0 𝑓 >| 𝑓 𝑐|
𝐻 ( 𝜔 )=
{ 1 𝑓 ≥| 𝑓 𝑐|
0 𝑓 <| 𝑓 𝑐|
𝑓 𝑐1 𝑓 𝑐2
𝑓 𝑐1 𝑓 𝑐2
𝐻 ( 𝜔 )=
{ 1| 𝑓 𝑐 1|≤ 𝑓 ≤| 𝑓 𝑐 2|
0 𝑓 >| 𝑓 𝑐 2| , 𝑓 <| 𝑓 𝑐 1|
𝐻 ( 𝜔 )=
{ 0| 𝑓 𝑐 1|≤ 𝑓 ≤| 𝑓 𝑐 2|
1 𝑓 >| 𝑓 𝑐 2|, 𝑓 <| 𝑓 𝑐 1|
Linear Filtering concept
(Mathematically)
x(n) y(n)
h(n)
∑ 𝑏𝑖 𝑧 − 𝑖
𝑖 =0
𝐻 ( 𝑧 )=
𝑖=0 𝑗=1 𝑄
∑ 𝑎𝑗 𝑧
− 𝑗
𝑗 =0
An ideal lowpass filter
{
𝜔𝑐
𝑛=𝑛0
h ( 𝑛) = 𝜋
sin 𝜔𝑐 (𝑛 − 𝑛 0)
𝑛 ≠ 𝑛0
(𝑛 − 𝑛0 ) 𝜋
Example
You are given a 20,000 data signal that consist of 3 frequency
(10Hz,100Hz, and 200Hz). The signal is sample at 2000 Hz. You are going
to design a low pass filter to filter out the high frequency (100 and 200
Hz) with filter order 100. What will the impulse response of low pass
filter look like?
Solution
First, we will simulate in matlab thus condition, where a signal of 20,000 data
with 3 frequency.
The code will be:
clear all
clc
And the impulse response for the low pass filter will be
{
0.02 𝜋
𝑛=𝑛0
𝜋
h ( 𝑛) =
sin 0.02 𝜋 (𝑛 − 𝑛 0)
𝑛 ≠ 𝑛0
(𝑛 − 𝑛 0) 𝜋
Solution
Here we will use 100 data filter (M=100) so will be half of it (100/2 =50).
To generate our impulse response, the command will be
fc=20;
Rc=fc/fs;
plot(t,x)
M=100; %filter order
for n=1:1:M
h(n)=sin(2*Rc*pi*(n-(M/2)))/(n-(M/2))/pi;
end
h(M/2)=Rc;
Solution
To test our filter, we will use convolution between the input signal (x)
with the impulse response (h). The command will be
y=conv(h,x);
And we will get the result of our y to be :
{
𝜔𝑐
1− 𝑛=𝑛 0
h ( 𝑛) = 𝜋
sin 𝜔 𝑐 (𝑛− 𝑛0 )
− 𝑛 ≠ 𝑛0
(𝑛 − 𝑛 0) 𝜋
Band pass filter
Band pass filter is the same as two low pass filter with different
frequency ( and ) substract each other
{
𝜔𝑐 2 𝜔𝑐 1
− 𝑛=𝑛0
h ( 𝑛) = 𝜋 𝜋
sin 𝜔𝑐 2 (𝑛 − 𝑛 0) − sin 𝜔𝑐 1 (𝑛 − 𝑛0 )
𝑛 ≠ 𝑛0
𝑓 𝑐1 𝑓 𝑐2 (𝑛 − 𝑛 0) 𝜋
Band stop filter
Band pass filter is the same as low pass filter () is added with high pass
filter( )
{
𝜔𝑐 1 𝜔𝑐 2
+1− 𝑛=𝑛0
h ( 𝑛) = 𝜋 𝜋
sin 𝜔𝑐 1 (𝑛 −𝑛 0) − sin 𝜔𝑐 2 (𝑛 − 𝑛0 )
𝑛 ≠ 𝑛0
(𝑛 − 𝑛 0) 𝜋
𝑓 𝑐1 𝑓 𝑐2