SlideShare a Scribd company logo
Fundamentals of Digital Signal Processing
Fourier Transform of continuous time signals
  





 dt
e
t
x
t
x
FT
F
X Ft
j 
2
)
(
)
(
)
(
  




 dF
e
F
X
F
X
IFT
t
x Ft
j 
2
)
(
)
(
)
(
with t in sec and F in Hz (1/sec).
Examples:
 
   
0 0 0
sinc
t
T
FT rect T FT

   
0
2 0
F
F
e
FT t
F
j

 

 
     
0
2
1
0
2
1
0
2
cos F
F
e
F
F
e
t
F
FT j
j




 



 

Discrete Time Fourier Transform of sampled signals
  






n
fn
j
e
n
x
n
x
DTFT
f
X 
2
]
[
]
[
)
(
  


2
1
2
1
2
)
(
)
(
]
[ df
e
f
X
f
X
IDTFT
n
x fn
j 
with f the digital frequency (no dimensions).
Example:
 
0
2
0
( )
j f n
k
DTFT e f f k




  

since, using the Fourier Series,
2
( ) j nt
k n
t k e 

 
 
 
 
Property of DTFT
• f is the digital frequency and has no dimensions
• is periodic with period f = 1.
)
1
(
)
( 
 f
X
f
X
2
1
2
1


 f


f
1
1
2
1
2

1

)
( f
X
• we only define it on one period
f
1
2

)
( f
X
1
2
t
F
j
e
t
x 0
2
)
( 

n
j
s
s
F
F
e
nT
x
n
x
0
2
)
(
]
[



s
s T
F /
1

Sampled Complex Exponential: no aliasing
0
F F
)
(F
X
f
( )
X f
2
1

1
2
1. No Aliasing
2
0
s
F
F 
2
s
F

2
s
F
0
f
s
F
F
f 0
0 
digital frequency
t
F
j
e
t
x 0
2
)
( 

n
j
s
s
F
F
e
nT
x
n
x
0
2
)
(
]
[



s
s T
F /
1

Sampled Complex Exponential: aliasing
0
F
F
)
(F
X
f
( )
X f
2
1

1
2
2. Aliasing 0
2
s
F
F 
2
s
F

2
s
F
0
f
0 0
0
s s
F F
f round
F F
 
   
 
digital frequency
t
F
j
e
t
x 0
2
)
( 
 0
2
[ ] ( ) j f n
s
x n x nT e 
 
s
s T
F /
1

Mapping between Analog and Digital Frequency










s
s F
F
round
F
F
f 0
0
0
Example
t
j
e
t
x 1000
2
)
( 

kHz
Fs 3

Then:
• analog frequency
• FT:
• digital frequency
•DTFT: for
)
1000
(
)
( 
 F
F
XFT 
Hz
F 1000
0 
   
0 0 1 1 1
0 3 3 3
s s
F F
F F
f round round
    
 
3
1
)
( 
 f
f
XDTFT  2
1
|
| 
f
Example
t
j
e
t
x 2000
2
)
( 

kHz
Fs 3

Then:
• analog frequency
• FT:
• digital frequency
•DTFT: for
)
2000
(
)
( 
 F
F
XFT 
Hz
F 2000
0 
 
3
1
)
( 
 f
f
XDTFT  2
1
|
| 
f
   
0 0 2 2 1
0 3 3 3
s s
F F
F F
f round round
     
Example
t
j
j
t
j
j
e
e
e
e
t
t
x 




 8000
1
.
0
2
1
8000
1
.
0
2
1
)
1
.
0
8000
cos(
)
( 





kHz
Fs 3

Then:
• analog frequencies
• FT:
• digital frequencies
•DTFT
)
4000
(
)
4000
(
)
( 1
.
0
2
1
1
.
0
2
1



 
F
e
F
e
F
X j
j
FT 
 

0 1
4000 , 4000
F Hz F Hz
  
2
1
|
| 
f
   
3
1
1
.
0
2
1
3
1
1
.
0
2
1
)
( 


 
f
e
f
e
f
X j
j
DTFT 
 

 
4 4 4 1
0 3 3 3 3
1
f round
    
 
4 4 4 1
1 3 3 3 3
( 1)
f round
         
Linear Time Invariant (LTI) Systems and z-Transform
]
[n
x ]
[n
y
]
[n
h
If the system is LTI we compute the output with the convolution:







m
m
n
x
m
h
n
x
n
h
n
y ]
[
]
[
]
[
*
]
[
]
[
If the impulse response has a finite duration, the system is called FIR
(Finite Impulse Response):
]
[
]
[
...
]
1
[
]
1
[
]
[
]
0
[
]
[ N
n
x
N
h
n
x
h
n
x
h
n
y 





  






n
n
z
n
x
n
x
Z
z
X ]
[
]
[
)
(
Z-Transform
Facts:
)
(
)
(
)
( z
X
z
H
z
Y 
]
[n
x ]
[n
y
)
(z
H
Frequency Response of a filter:
f
j
e
z
z
H
f
H 
2
)
(
)
( 

Digital Filters
)
(z
H
]
[n
x ]
[n
y
Ideal Low Pass Filter
f
2
1
2
1

)
( f
H
f
2
1
2
1

)
( f
H

P
f
P
f
passband
constant magnitude
in passband…
… and linear phase
A
Impulse Response of Ideal LPF

 



P
P
f
f
fn
j
fn
j
ideal df
Ae
df
e
f
H
n
h 
 2
2
2
1
2
1
)
(
]
[
Assume zero phase shift,
  
n
f
sinc
Af
n
h P
P
ideal 2
2
]
[ 
This has Infinite Impulse Response, non recursive and it is non-
causal. Therefore it cannot be realized.
-50 -40 -30 -20 -10 0 10 20 30 40 50
-0.05
0
0.05
0.1
0.15
0.2
n
fp=0.1
[ ]
h n
n
0.1
1
P
f
A


Non Ideal Ideal LPF
The good news is that for the Ideal LPF
0
]
[
lim 


n
hideal
n
n
]
[n
h
L
 L
n
L
2
L
]
[n
h
Frequency Response of the Non Ideal LPF
P
f STOP
f
pass
stop stop
f
transition region
attenuation
ripple
|
)
(
| f
H
1
1 

1
1 

2

LPF specified by:
• passband frequency
• passband ripple or
• stopband frequency
• stopband attenuation or
P
f
1
 dB
RP 1
1
1
1
10
log
20 




STOP
f
2
 dB
R 2
S 
10
log
20

Best Design tool for FIR Filters: the Equiripple algorithm (or Remez). It
minimizes the maximum error between the frequency responses of the
ideal and actual filter.
1
f 2
f 2
1
attenuation
ripple
|
)
(
| f
H
1
1 

1
1 

2

     
 
1 2 3 3 1 2
, 0, , , / , 1,1,0,0 , ,
h firpm N f f f f w w

impulse response
 
]
[
],...,
0
[ N
h
h
h 
1
f 2
f 2
1
3 
f
0
Linear Interpolation
1
1
/ w

2
/ w

The total impulse response length N+1 depends on:
• transition region
• attenuation in the stopband
1
f 2
f
|
)
(
| f
H
2

1
2 f
f
f 


 N
f
1
~ 22
)
(
log
20 2
10 

Example:
we want
Passband: 3kHz
Stopband: 3.5kHz
Attenuation: 60dB
Sampling Freq: 15 kHz
Then: from the specs
We determine the order the filter
30
1
0
.
15
0
.
3
5
.
3


 
f
82
30
~ 22
60


N
Frequency response
0 0.1 0.2 0.3 0.4 0.5
-100
-80
-60
-40
-20
0
20
magnitude
digital frequency
dB
0 0.1 0.2 0.3 0.4 0.5
-120
-100
-80
-60
-40
-20
0
20
magnitude
digital frequency
dB
N=82
N=98
Example: Low Pass Filter
0 0.1 0.2 0.3 0.4 0.5
-120
-100
-80
-60
-40
-20
0
20
magnitude
digital frequency
dB
Passband f = 0.2
Stopband f = 0.25 with attenuation 40dB
Choose order N=40/(22*(0.25-0.20))=37
| ( ) |
H f
f
Almost 40dB!!!
Example: Low Pass Filter
Passband f = 0.2
Stopband f = 0.25 with attenuation 40dB
Choose order N=40 > 37
| ( ) |
H f
f
0 0.1 0.2 0.3 0.4 0.5
-80
-70
-60
-50
-40
-30
-20
-10
0
10
magnitude
digital frequency
dB
OK!!!
General FIR Filter of arbitrary Frequency Response
]
,...,
,
[
]
,...,
,
,
0
[
1
0
2
1
M
M
H
H
H
H
f
f
f
f


0 1
f 2
f 3
f 1

M
f 2
1

M
f
0
H
1
H
2
H
3
H 1

M
H M
H
Weights for Error:
1
w
2
w 2
/
)
1
( 
M
w
]
,...,
,
[ 2
/
)
1
(
2
1 
 M
w
w
w
w
Then apply:
 
, / , ,
M
h firpm N f f H w

… and always check frequency response if it is what you expect!
Example:
( ) 1/sinc( )
H f f
 for 0 0.2
f
 
( ) 0
H f  0.25 0.5
f
 
0 0.2 0.25 0.5 f
fp=0:0.01:0.2; % vector of passband frequencies
fs=[0.25,0.5]; % stopband frequencies
M=[1./sinc(fp), 0, 0]; % desired magnitudes
Df=0.25-0.2; % transition region
N=ceil(A/(22*Df)); % first guess of order
h=firpm(N, [ fp, fs]/0.5,M); % impulse response
40
A dB

0 0.1 0.2 0.3 0.4 0.5
0
0.2
0.4
0.6
0.8
1
1.2
1.4
magnitude
digital frequency
0 0.1 0.2 0.3 0.4 0.5
-90
-80
-70
-60
-50
-40
-30
-20
-10
0
10
not very good here!
dB
37
N 
To improve it:
1. Increase order
2. Add weights
0 0.2 0.25 0.5 f
40
A dB

1
w  0.2
w 
w=[1*ones(1,length(fp)/2), 0.2*ones(1, length(fs)/2)];
h=firpm(N, [fp, fs]/0.5,M,w);
0 0.1 0.2 0.3 0.4 0.5
0
0.2
0.4
0.6
0.8
1
1.2
1.4
magnitude
digital frequency
0 0.1 0.2 0.3 0.4 0.5
-160
-140
-120
-100
-80
-60
-40
-20
0
20
100
N 
dB

More Related Content

PPTX
Digital signal processing 22 scheme notes
PPTX
Design of Filters PPT
PDF
Digital Signal Processing-Digital Filters
PPT
PPTX
FIR Filters Lecture (What are FIR FIlters)pptx
PDF
PPT s05-machine vision-s2
PDF
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
Digital signal processing 22 scheme notes
Design of Filters PPT
Digital Signal Processing-Digital Filters
FIR Filters Lecture (What are FIR FIlters)pptx
PPT s05-machine vision-s2
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...

Similar to 1-DSP Fundamentals.ppt (20)

PDF
Advanced_DSP_J_G_Proakis.pdf
PDF
Course-Notes__Advanced-DSP.pdf
PPTX
Design of digital filters
PPTX
Design of infinite impulse response digital filters 2
PDF
DSP - Realization of Finite Impulse Response Filter
PPTX
Some important topics in IIR filter.pptx
PDF
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
PDF
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
PPTX
filter design
PPT
Filter- IIR - Digital signal processing(DSP)
PDF
(Original PDF) Applied Digital Signal Processing Theory and Practice
PDF
Digital Signal Processing Summary
PDF
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
PPTX
Importance of FIR filters power point.pptx
PPTX
Digital filters and FIR Filter Design in Future Multicarrier Communication Sy...
PDF
DSP 2.pdf
PDF
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
PPT
BUTTERWORTH FILTER AND CHEBYSHEW FILTERS
PPTX
Note and assignment mis3 5.3
Advanced_DSP_J_G_Proakis.pdf
Course-Notes__Advanced-DSP.pdf
Design of digital filters
Design of infinite impulse response digital filters 2
DSP - Realization of Finite Impulse Response Filter
Some important topics in IIR filter.pptx
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
filter design
Filter- IIR - Digital signal processing(DSP)
(Original PDF) Applied Digital Signal Processing Theory and Practice
Digital Signal Processing Summary
Solution Manual for Introduction to Digital Signal Processing, 1st Edition, D...
Importance of FIR filters power point.pptx
Digital filters and FIR Filter Design in Future Multicarrier Communication Sy...
DSP 2.pdf
DSP_2018_FOEHU - Lec 07 - IIR Filter Design
BUTTERWORTH FILTER AND CHEBYSHEW FILTERS
Note and assignment mis3 5.3
Ad

More from KrishnaveniManickam3 (11)

PPT
UNIT 03 ORGANISING.ppt
PPT
UNIT 5 CONTROLLING.ppt
PPTX
boolean-logic.pptx
PPTX
Review report-template_ECE_AVSEC (10_09_2014).pptx
PPT
PPTX
piezo ele.ppt.pptx
PPT
PPTX
PPT
staffing.ppt
PPT
UNIT 5 CONTROLLING.ppt
PPT
Organising unit ppt.ppt
UNIT 03 ORGANISING.ppt
UNIT 5 CONTROLLING.ppt
boolean-logic.pptx
Review report-template_ECE_AVSEC (10_09_2014).pptx
piezo ele.ppt.pptx
staffing.ppt
UNIT 5 CONTROLLING.ppt
Organising unit ppt.ppt
Ad

Recently uploaded (20)

PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Digital Logic Computer Design lecture notes
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Well-logging-methods_new................
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
DOCX
573137875-Attendance-Management-System-original
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
Project quality management in manufacturing
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Internet of Things (IOT) - A guide to understanding
Mechanical Engineering MATERIALS Selection
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Digital Logic Computer Design lecture notes
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Well-logging-methods_new................
bas. eng. economics group 4 presentation 1.pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
573137875-Attendance-Management-System-original
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Project quality management in manufacturing
additive manufacturing of ss316l using mig welding
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
OOP with Java - Java Introduction (Basics)
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT

1-DSP Fundamentals.ppt

  • 1. Fundamentals of Digital Signal Processing
  • 2. Fourier Transform of continuous time signals          dt e t x t x FT F X Ft j  2 ) ( ) ( ) (         dF e F X F X IFT t x Ft j  2 ) ( ) ( ) ( with t in sec and F in Hz (1/sec). Examples:       0 0 0 sinc t T FT rect T FT      0 2 0 F F e FT t F j             0 2 1 0 2 1 0 2 cos F F e F F e t F FT j j            
  • 3. Discrete Time Fourier Transform of sampled signals          n fn j e n x n x DTFT f X  2 ] [ ] [ ) (      2 1 2 1 2 ) ( ) ( ] [ df e f X f X IDTFT n x fn j  with f the digital frequency (no dimensions). Example:   0 2 0 ( ) j f n k DTFT e f f k         since, using the Fourier Series, 2 ( ) j nt k n t k e          
  • 4. Property of DTFT • f is the digital frequency and has no dimensions • is periodic with period f = 1. ) 1 ( ) (   f X f X 2 1 2 1    f   f 1 1 2 1 2  1  ) ( f X • we only define it on one period f 1 2  ) ( f X 1 2
  • 5. t F j e t x 0 2 ) (   n j s s F F e nT x n x 0 2 ) ( ] [    s s T F / 1  Sampled Complex Exponential: no aliasing 0 F F ) (F X f ( ) X f 2 1  1 2 1. No Aliasing 2 0 s F F  2 s F  2 s F 0 f s F F f 0 0  digital frequency
  • 6. t F j e t x 0 2 ) (   n j s s F F e nT x n x 0 2 ) ( ] [    s s T F / 1  Sampled Complex Exponential: aliasing 0 F F ) (F X f ( ) X f 2 1  1 2 2. Aliasing 0 2 s F F  2 s F  2 s F 0 f 0 0 0 s s F F f round F F         digital frequency
  • 7. t F j e t x 0 2 ) (   0 2 [ ] ( ) j f n s x n x nT e    s s T F / 1  Mapping between Analog and Digital Frequency           s s F F round F F f 0 0 0
  • 8. Example t j e t x 1000 2 ) (   kHz Fs 3  Then: • analog frequency • FT: • digital frequency •DTFT: for ) 1000 ( ) (   F F XFT  Hz F 1000 0      0 0 1 1 1 0 3 3 3 s s F F F F f round round        3 1 ) (   f f XDTFT  2 1 | |  f
  • 9. Example t j e t x 2000 2 ) (   kHz Fs 3  Then: • analog frequency • FT: • digital frequency •DTFT: for ) 2000 ( ) (   F F XFT  Hz F 2000 0    3 1 ) (   f f XDTFT  2 1 | |  f     0 0 2 2 1 0 3 3 3 s s F F F F f round round      
  • 10. Example t j j t j j e e e e t t x       8000 1 . 0 2 1 8000 1 . 0 2 1 ) 1 . 0 8000 cos( ) (       kHz Fs 3  Then: • analog frequencies • FT: • digital frequencies •DTFT ) 4000 ( ) 4000 ( ) ( 1 . 0 2 1 1 . 0 2 1      F e F e F X j j FT     0 1 4000 , 4000 F Hz F Hz    2 1 | |  f     3 1 1 . 0 2 1 3 1 1 . 0 2 1 ) (      f e f e f X j j DTFT       4 4 4 1 0 3 3 3 3 1 f round        4 4 4 1 1 3 3 3 3 ( 1) f round          
  • 11. Linear Time Invariant (LTI) Systems and z-Transform ] [n x ] [n y ] [n h If the system is LTI we compute the output with the convolution:        m m n x m h n x n h n y ] [ ] [ ] [ * ] [ ] [ If the impulse response has a finite duration, the system is called FIR (Finite Impulse Response): ] [ ] [ ... ] 1 [ ] 1 [ ] [ ] 0 [ ] [ N n x N h n x h n x h n y      
  • 12.          n n z n x n x Z z X ] [ ] [ ) ( Z-Transform Facts: ) ( ) ( ) ( z X z H z Y  ] [n x ] [n y ) (z H Frequency Response of a filter: f j e z z H f H  2 ) ( ) (  
  • 13. Digital Filters ) (z H ] [n x ] [n y Ideal Low Pass Filter f 2 1 2 1  ) ( f H f 2 1 2 1  ) ( f H  P f P f passband constant magnitude in passband… … and linear phase A
  • 14. Impulse Response of Ideal LPF       P P f f fn j fn j ideal df Ae df e f H n h   2 2 2 1 2 1 ) ( ] [ Assume zero phase shift,    n f sinc Af n h P P ideal 2 2 ] [  This has Infinite Impulse Response, non recursive and it is non- causal. Therefore it cannot be realized. -50 -40 -30 -20 -10 0 10 20 30 40 50 -0.05 0 0.05 0.1 0.15 0.2 n fp=0.1 [ ] h n n 0.1 1 P f A  
  • 15. Non Ideal Ideal LPF The good news is that for the Ideal LPF 0 ] [ lim    n hideal n n ] [n h L  L n L 2 L ] [n h
  • 16. Frequency Response of the Non Ideal LPF P f STOP f pass stop stop f transition region attenuation ripple | ) ( | f H 1 1   1 1   2  LPF specified by: • passband frequency • passband ripple or • stopband frequency • stopband attenuation or P f 1  dB RP 1 1 1 1 10 log 20      STOP f 2  dB R 2 S  10 log 20 
  • 17. Best Design tool for FIR Filters: the Equiripple algorithm (or Remez). It minimizes the maximum error between the frequency responses of the ideal and actual filter. 1 f 2 f 2 1 attenuation ripple | ) ( | f H 1 1   1 1   2          1 2 3 3 1 2 , 0, , , / , 1,1,0,0 , , h firpm N f f f f w w  impulse response   ] [ ],..., 0 [ N h h h  1 f 2 f 2 1 3  f 0 Linear Interpolation 1 1 / w  2 / w 
  • 18. The total impulse response length N+1 depends on: • transition region • attenuation in the stopband 1 f 2 f | ) ( | f H 2  1 2 f f f     N f 1 ~ 22 ) ( log 20 2 10   Example: we want Passband: 3kHz Stopband: 3.5kHz Attenuation: 60dB Sampling Freq: 15 kHz Then: from the specs We determine the order the filter 30 1 0 . 15 0 . 3 5 . 3     f 82 30 ~ 22 60   N
  • 19. Frequency response 0 0.1 0.2 0.3 0.4 0.5 -100 -80 -60 -40 -20 0 20 magnitude digital frequency dB 0 0.1 0.2 0.3 0.4 0.5 -120 -100 -80 -60 -40 -20 0 20 magnitude digital frequency dB N=82 N=98
  • 20. Example: Low Pass Filter 0 0.1 0.2 0.3 0.4 0.5 -120 -100 -80 -60 -40 -20 0 20 magnitude digital frequency dB Passband f = 0.2 Stopband f = 0.25 with attenuation 40dB Choose order N=40/(22*(0.25-0.20))=37 | ( ) | H f f Almost 40dB!!!
  • 21. Example: Low Pass Filter Passband f = 0.2 Stopband f = 0.25 with attenuation 40dB Choose order N=40 > 37 | ( ) | H f f 0 0.1 0.2 0.3 0.4 0.5 -80 -70 -60 -50 -40 -30 -20 -10 0 10 magnitude digital frequency dB OK!!!
  • 22. General FIR Filter of arbitrary Frequency Response ] ,..., , [ ] ,..., , , 0 [ 1 0 2 1 M M H H H H f f f f   0 1 f 2 f 3 f 1  M f 2 1  M f 0 H 1 H 2 H 3 H 1  M H M H Weights for Error: 1 w 2 w 2 / ) 1 (  M w ] ,..., , [ 2 / ) 1 ( 2 1   M w w w w Then apply:   , / , , M h firpm N f f H w  … and always check frequency response if it is what you expect!
  • 23. Example: ( ) 1/sinc( ) H f f  for 0 0.2 f   ( ) 0 H f  0.25 0.5 f   0 0.2 0.25 0.5 f fp=0:0.01:0.2; % vector of passband frequencies fs=[0.25,0.5]; % stopband frequencies M=[1./sinc(fp), 0, 0]; % desired magnitudes Df=0.25-0.2; % transition region N=ceil(A/(22*Df)); % first guess of order h=firpm(N, [ fp, fs]/0.5,M); % impulse response 40 A dB 
  • 24. 0 0.1 0.2 0.3 0.4 0.5 0 0.2 0.4 0.6 0.8 1 1.2 1.4 magnitude digital frequency 0 0.1 0.2 0.3 0.4 0.5 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 not very good here! dB 37 N 
  • 25. To improve it: 1. Increase order 2. Add weights 0 0.2 0.25 0.5 f 40 A dB  1 w  0.2 w  w=[1*ones(1,length(fp)/2), 0.2*ones(1, length(fs)/2)]; h=firpm(N, [fp, fs]/0.5,M,w);
  • 26. 0 0.1 0.2 0.3 0.4 0.5 0 0.2 0.4 0.6 0.8 1 1.2 1.4 magnitude digital frequency 0 0.1 0.2 0.3 0.4 0.5 -160 -140 -120 -100 -80 -60 -40 -20 0 20 100 N  dB