Professional Documents
Culture Documents
SIGNAL
s[n]
x[n] Filter
v[n]
NOISE
y[n] s[n]
n
SIGNAL
v[n] NOISE
s[n]
Filter
n
y[n] s[n]
x[n]
SIGNAL
NOISE
| S ( ) |
| V ( ) |
P
Mostly NOISE
Mostly
SIGNAL
(rad )
Mostly NOISE
IDEAL Filter
Since the filter has real coefficients, we need only the
positive frequencies
H ( )
PASS
Band
p STOP
Band
Non-IDEAL Filter
Since the filter has real coefficients, we need only the
positive frequencies
| H ( ) |
PASS
Band
Trans.
Band
STOP
Band
P P
j n
h
[
n
]
e
d
1
hd [n] IDTFT H d ()
2
1
hd [ n]
2
j n
j n
H
(
)
e
d
d
sin P n P
P
d
sinc
n
n
H d ()
j n
h
[
n
]
e
d
hd [n]
Hd ( )
P
sinc P n
P P
0.3
0.25
0.2
0.15
0.1
0.05
0
-0.05
-0.1
-60
-40
-20
20
40
60
lim hd [n] 0
H d ()
j n
h
[
n
]
e
d
n L
H () h[n]e
j n
n 0
actual
2L
hd [n L]e
n 0
j n
hd [n]e
n L
j n
e jL H d ( )e jL
desired
P
P
h[n]
sinc
(n L) , n 0,..., N
2L
H () h[n]e jn H d ( )e jL
n 0
H ( ) H d ( )
H ( ) H d ( ) L
L in the passband
h=(wp/pi)*sinc((wp/pi)*(n-L));
freqz(h)
Magnitude (dB)
50
0
20dB
-50
-100
0.1
0
Phase (degrees)
n=0:N;
L 20, N 40
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.9
20
-500
-1000
-1500
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
Impulse Response
n=0:N;
stem(n,h)
h[n]
0.3
0.25
0.2
0.15
0.1
0.05
0
-0.05
-0.1
10
15
20
25
30
35
40
2n
0.54 0.46 cos
, n 0,...,40
40
hamming window
n=0:N;
h0=(wp/pi)*sinc((wp/pi)*(n-L));
h=h0.*hamming(N);
stem(n,h)
h[n]
0.3
0.25
0.2
0.15
0.1
0.05
0
-0.05
10
15
20
25
30
35
40
2n
0.54 0.46 cos
, n 0,...,40
40
hamming window
Magnitude (dB)
50
0
~ 50dB
-50
-100
-150
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0
Phase (degrees)
freqz(h)
H ( )
-500
-1000
-1500
window
Rectangular
4 / N
Hamming
8-43dB
/N
Blackman
12 / N
attenuation
-13dB
0
-20
attenuation
-40
-60
-58dB
-80
-100
-120
0.5
P S
1.5
2.5
transition region
40dB
02 4 / 20 2 / 5rad
Stop Band
2 5 / 20 / 2 rad
hd (n)
P
2
2n
sinc P n sinc
5
5
4 5
2
5 2
10
F kHz
10
Step 3: from desired attenuation choose the window. In this case we can choose the
hamming window;
Step 4: from the transition region choose the length N of the impulse response.
Choose an even number N such that:
N 10
2
2(n - 40)
2 n
0.54 0.46 cos
sinc
80
5
h ( n) 5
, if 0 n 80,
otherwise
H( )
dB
H( )
rad
Design Parameters
Pass Band Frequency
Stop Band Frequency
Pass Band Ripple
Stop Band Attenuation
p rad.
S rad.
20 log10 A / B dB
20 log10 A / C dB
H ( )
A
B
f 2 STOP
f 1
f=[0,f1,f2,1];
where
A=[1,1,0,0];
Linear Interpolation
1
0
PASS
STOP
(rad )
Attenuation (dB)
N~
11 STOP PASS /
Step 3: call firpm (pm = Parks, McClellan)
h=firpm(N,f,A);
which yields the desired impulse response
h h[0], h[1] h[ N ]
3,000 2
15,000 5
3,500 7
STOP 2
15,000 15
60
N
82
7
2
11 15 5
PASS 2
h=firpm(82,[0,2/5,7/15,1],[1,1,0,0]);
Frequency Response
freqz(h)
Magnitude (dB)
50
0
-50
-100
Increase N.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
Phase (degrees)
0
-1000
-2000
-3000
-4000
50
0
-50
-100
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
Phase (degrees)
0
-1000
-2000
-3000
-4000
10
20
30
40
50
60
70
80
90
100
Typical Applications
In applications such as Radar, Sonar or Digital Communications we transmit a
Pulse or a sequence of pulses.
For example, we transmit a short sinusoidal burst:
F0 500 Hz
1.5
1
T1 8 m sec
0.5
0
-0.5
-1
-1.5
-2
4
sec
8
-3
x 10
Typical Applications
For example in a communications signal we send 0 and 1.
For example let:
1 x(t )
0 x(t )
4
Transmitted:
3
2
1
0
-1
-2
-3
-4
1
0
0.005
0.01
1
0.015
millisec
0.02
0
0.025
0.03
8
6
4
2
0
-2
-4
-6
-8
0.005
0.01
0.015
millisec
0.02
0.025
0.03
DTFT of Signal
Magnitude of the DFT of the Pulse (in dB):
dB
50
40
30
20
10
0
-10
-20
-30
-40
-50
1000
2000
3000
4000
5000
6000
7000
8000
9000
Hz
DTFT of Signal
Bandwidth of the Signal (take about -20dB from max) is about 1.0kHz
50
40
~ 20dB
30
20
10
0
-10
-20
-30
-40
-50
1000
2000
3000
4000
5000
6000
7000
8000
9000
N=81
Magnitude (dB)
Attenuation 40dB
0
-50
-100
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
Normalized Frequency ( rad/sample)
0.9
0
Phase (degrees)
50
-500
-1000
-1500
Filtered Data
10
5
Received signal:
0
-5
-10
10
15
millisec
20
25
30
35
4
2
and Filtered:
0
-2
-4
10
15
20
millisec
25
30
35
4
3
Compare to
the original:
2
1
0
-1
-2
-3
-4
0.005
0.01
0.015
millisec
0.02
0.025
0.03
40