![]() |
![]() |
|
|
| <<Home | Lab 9 (Design of FIR Filters) | |||
|
a) Optimal Method The signal processing in MATLAB (Matrix Lab) contains a number of design programs and functions for designing optimal FIR filters based on Remez and other algorithms. The Remez command is the key command for calculating FIR coefficients via the optimal method. A linear phase band pass filter Example 1 A linear phase band-pass filter is required to meet the following specifications: Passband 900 - 1100 Hz Passband ripple < 0.87 dB (take any value less than 0.87) Stopband frequency > 30dB (take any value greater than 30) sampling frequency 15kHz Transition frequency 450 Hz. Use the optimal method to obtain suitable coefficients. Plot the magnitude and phase spectrum, Filter length is 41. Solution Fs =15000; %Sampling frequency N=41; %Length of filter M=[0 0 1 1 0 0]; % Desired response (at 900 and 1100Hz) F=[0 450/7500 900/7500 1100/7500 1550/7500 7500/7500]; % Normalized bandedge frequencies (F/Fs) W=[3.33 1 3.33]; % weight vector (refer class work ) B=remez(N-1, F, M, W); % filter coefficients [H,f]=freqz(B,1,1024,Fs); H1=abs(H); mag=20*log10(H1); plot(f,mag); grid; Xlabel('Frequency (Hz)'); Ylabel('Magnitude(dB)'); figure; phase=angle(H); plot(f,phase); grid Result
Frequency response is observed at about 450 - 1650Hz, rather than 900 - 1100 Hz because of 450Hz transition frequency.
A linear phase band-pass filter
Example 2 A linear phase bandpass filter is required to meet the following specifications: Passband 12-16 kHz Transition width 2kHz Pass-band ripple 1 dB Stop-band attenuation 45 dB Sampling frequency 50 kHz Estimate the filter length , N, and use the optimal method to determine the filter coefficients and hence plot the magnitude-frequency response. Compute the pass and stop-band ripples of the filter with the specified values. Solution fs=50000; ap=1; as=45; m=[0 1 0] F=[10000 12000 16000 18000]; dp=(10^(ap/20)-1)/(10^(ap/20)+1); ds=10^(-as/20); dev=[ds dp ds]; [N1, f0, m0, w]=remezord(F,m,dev,fs); b=remez(N1-1,f0,m0,w); [H,f] = freqz(b,1,1024,fs); mag = 20*log10(abs(H)); plot(f,mag) xlabel('Frequency (Hz)') ylabel('Magnitude (dB)') grid Result
FIR low-pass digital filter
Exercise 1 An FIR low-pass digital filter is required to meet the following characteristics: Stop-band edge frequency > 40 dB Pass-band edge frequency 100 Hz Pass-band ripple < 0.05 dB Transition width 10 Hz Sampling frequency 1024 Hz Calculate and list the coefficients of the filter using the optimal method. Sketch magnitude response of the filter. Solution
Result
FIR low-pass digital filter
Exercise 2 An FIR low-pass digital filter is required to meet the following characteristics: Pass-band 12 - 16 kHz Transition width 3 kHz Sampling frequency 96 kHz Pass-band ripple 0.01 dB Stop-band ripple 80 dB Calculate and list the coefficients of the filter using the optimal method. Sketch magnitude response of the filter. Also estimate the filter length. Solution
Result
A digital FIR notch filter
Exercise 3 A digital FIR notch filter satisfying the specifications given below is required. Lower pass-band 0 to 0.21 Notch frequency 0.25 Upper pass-band 0.29 to 0.5 Pass-band deviation 0.00115 Stop-band deviation 0.001 Solution
Result
b) Frequency Sampling Method: The fir2 command is used to design FIR filters with arbitrary frequency response characteristics such as those encountered in the frequency sampling method Coefficients of the filter
Example 3
Solution
Result
HELP PLOT
PLOT Linear plot. STEM
STEM Discrete sequence or "stem" plot.
SAWTOOTH
SAWTOOTH Sawtooth and
triangle wave generation. SQUARE
SQUARE Square wave generation. ONES
ONES Ones array. SINC
SINC Sin(pi*x)/(pi*x) function. RECTPULS
RECTPULS Sampled aperiodic rectangle generator.
TRIPULS Sampled aperiodic triangle
generator. DSP Lab 1 DSP Lab2 DSP Lab 3 DSP Lab4 DSP Lab 5 DSP Lab 6 DSP Lab7 DSP Lab8 DSP Lab9 DSP Lab10 Other material |
||||
| <<Home | ||||
|
||||||