FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter...
-
Upload
merryl-amice-miller -
Category
Documents
-
view
250 -
download
4
Transcript of FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter...
![Page 1: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/1.jpg)
FIR Filter Design
6-1
Practical Signal Processing Concepts and Algorithms using MATLAB
FIR Filter Design
![Page 2: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/2.jpg)
FIR Filter Design
6-2
Section Outline
• FIR design methods• Windowing• Standard band filters• Arbitrary response filters• Multiband filters• Raised cosine filters• Frequency domain filtering
I II III IV
![Page 3: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/3.jpg)
FIR Filter Design
6-3
FIR Filter Design
FIR filters have the following advantages:
• Exactly linear phase is possible
• Always stable, even when quantized
• Design methods are generally linear
• Efficient hardware realizations
• Startup transients have finite duration
FIR filters have the following disadvantages:
• Higher filter order than IIR filters
• Corresponding greater delays
![Page 4: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/4.jpg)
FIR Filter Design
6-4
FIR Methods
Filter Method Description Filter Functions
Windowing Apply window to truncated inverse Fourier transform of desired filter
fir1, fir2, kaiserord
Multiband with Transition Bands
Equiripple or least squares approach over frequency sub-bands
firls, firpm, firpmord
Constrained Least Squares
Minimize squared integral error over entire frequency range subject to maximum error constraints
fircls, fircls1
Arbitrary Response
Arbitrary responses, including nonlinear phase and complex filters
cfirpm
Raised Cosine Lowpass response with smooth, sinusoidal transition
firrcos
![Page 5: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/5.jpg)
FIR Filter Design
6-5
Method Description Functions
WindowingApply window to truncated inverse Fourier transform of desired "brick wall" filter
fir1, fir2, kaiserord
Multiband with Transition Bands
Equiripple or least squares approach over sub-bands of the frequency range
firls, remez, remezord
Constrained Least Squares
Minimize squared integral error over entire frequency range subject to maximum error constraints
fircls, fircls1
Arbitrary Response
Arbitrary responses, including nonlinear phase and complex filters
cremez
Raised Cosine Lowpass response with smooth, sinusoidal transition
firrcos
![Page 6: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/6.jpg)
FIR Filter Design
6-6
Impulse Response Revisited
M
mm mnxbny
0
)()(FIR filter:
>> b = [b0 b1 … bM]; a = 1; no need to specify
stem(b) impz(b,1)
FIR filter coefficients give the impulse response
![Page 7: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/7.jpg)
FIR Filter Design
6-7
Linear Phase Filters
Impulse response is symmetric about its midpoint:
Except for cfirpm, all of the FIR filter design functions in the Signal Processing Toolbox design linear phase filters only.
constant phase delay constant group delay
no phase distortion
–φ(ω)/ω –dφ(ω)/dω
![Page 8: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/8.jpg)
FIR Filter Design
6-8
FIR Filter Types
Filter Type
Filter Order
Symmetry Response H(0) Response H(1)(Nyquist)
Type I Even No restriction No restriction
Type II Odd No restriction H(1) = 0
Type III Even H(0) = 0 H(1) = 0
Type IV Odd H(0) = 0 No restriction
1,...,1),2()( nkknbkb
1,...,1),2()( nkknbkb
fir1,fir2,firls,firpm,fircls,fircls1,firrcos
No highpass or bandstop filters
odd length,even symmetry
even length,even symmetry
odd length,odd symmetry
even length,odd symmetry
I II III IV
length of impulse response - 1
1,...,1),2()( nkknbkb
1,...,1),2()( nkknbkb
![Page 9: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/9.jpg)
FIR Filter Design
6-9
Digital filters with finite-duration impulse response (all-zero, or FIR filters) have both advantages and disadvantages compared to infinite-duration impulse response (IIR) filters.
FIR filters have the following primary advantages:
• They can have exactly linear phase.
• They are always stable.
• The design methods are generally linear.
• They can be realized efficiently in hardware.
• The filter startup transients have finite duration.
The primary disadvantage of FIR filters is that they often require a much higher filter order than IIR filters to achieve a given level of performance. Correspondingly, the delay of these filters is often much greater than for an equal performance IIR filter.
![Page 10: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/10.jpg)
FIR Filter Design
6-10
• Example 1Example 1
Design a 48th-order FIR bandpass filter with passband 0.35 0.65:
• SolutionSolution>>b = fir1(48,[0.35 0.65]);
>>freqz(b,1,512)
• Example 2Example 2::
Design a lowpass filter with the following specifications using the optimal design method :
>>rp = 0.01; % Passband ripple
>>rs = 0.1; % Stopband ripple
>>fs = 8000; % Sampling frequency
>>f = [1500 2000]; % Cutoff frequencies
>>a = [1 0]; % Desired amplitudes
![Page 11: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/11.jpg)
FIR Filter Design
6-11
• SolutionSolution
>>[n,fo,ao,w] = remezord(f,a,dev,fs);
>> dev=[0.01 0.1]
>>[n,fo,ao,w]=remezord([1500 2000],[1 0],dev,8000);
% approximate order, normalized frequency band edges, frequency band amplitudes, and weights that meet input specifications f, a, and dev.%
>>b=remez(n,fo,ao,w);
%use n, fo, ao and w to design the filter b which approximately meets the specifications given by remezord input parameters f, a, and dev.%
>>freqz(b,1,1024,8000);
>>title('Lowpass Filter Designed to Specifications');
![Page 12: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/12.jpg)
FIR Filter Design
6-12
Window-Based Design
fft
ifft
H(f) h(n)
hw(n)HW(f)
h.*w
![Page 13: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/13.jpg)
FIR Filter Design
6-13
Windowing Functions
bartlett, barthannwin, blackman, blackmanharris, bohmanwin, chebwin, flattopwin, gausswin, hamming, hann, kaiser, parsenwin, rectwin, triang, tukeywin
.* =
W = gausswin(2*length(y),3);w = W(length(y)+1:end);
y = sin(n); wy = w'.*y;
![Page 14: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/14.jpg)
FIR Filter Design
6-14
Windowing and Spectra
Truncated Signal and DFT:
Truncated, Windowed Signal and DFT
wider main lobe
lower side lobes>> windft
![Page 15: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/15.jpg)
FIR Filter Design
6-15
Window Visualization Tool
>> wvtool(kaiser(32,1),kaiser(32,5),kaiser(32,10))
![Page 16: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/16.jpg)
FIR Filter Design
6-16
Window Design and Analysis Tool
>> wintool
![Page 17: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/17.jpg)
FIR Filter Design
6-17
Example: Lowpass Filter
)(sinc2
1)(
2
1)( 000
0
ndedeHnh njnj
>> b = ...0.4*sinc(...0.4*(-25:25));>> fvtool(b,1)
>> bw = ...b.*hamming(51)';>> fvtool(bw,1)
Right click on the y-axis label in FVTool and choose Magnitude squared
![Page 18: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/18.jpg)
FIR Filter Design
6-18
Standard Band FIR Design
>> b = fir1(n,Wn,'stop',kaiser(n+1,beta));
![Page 19: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/19.jpg)
FIR Filter Design
6-19
Arbitrary Response FIR Filters
>> b = fir2(n,f,m,window);
![Page 20: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/20.jpg)
FIR Filter Design
6-20
Multiband Filters
>> b = firls(n,f,a)
![Page 21: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/21.jpg)
FIR Filter Design
6-21
Raised Cosine Filters
>> b = firrcos(n,F0,df,fs);
![Page 22: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/22.jpg)
FIR Filter Design
6-22
Frequency Domain Filtering
y(n) long x(n)
finite buffer
Overlap-add method (fftfilt):
• Partion x(n) into data blocks
• FFT to the frequency domain
• Convolve blocks efficiently with b using multiplication
• IFFT back to the time domain
• Assemble shifted partial convolutions using superposition
b
![Page 23: FIR Filter Design 6-1 Practical Signal Processing Concepts and Algorithms using MATLAB FIR Filter Design.](https://reader036.fdocuments.net/reader036/viewer/2022081504/56649de45503460f94adab0b/html5/thumbnails/23.jpg)
FIR Filter Design
6-23
Section Summary
• FIR design methods• Windowing• Standard band filters• Arbitrary response filters• Multiband filters• Raised cosine filters• Frequency domain filtering
I II III IV