ZhankunLuo hw6
ZhankunLuo hw6
Chapter 7:
Problems 7.1, 7.2 (b), 7.5 (b), 7.6 (b), 7.7, 7.8, 7.9, 7.10, 7.11, 7.15, 7.19, 7.20
Problems
Problems 7.1
Design a three-tap FIR lowpass filter with a cutoff frequency of 1500 Hz and a sampling
rate of
8000 Hz using
Determine the transfer function and difference equation of the designed FIR system, and
compute and plot the magnitude frequency response for Ω=0, π/4, π/2, 3π/4, and π (rad).
solution
h(-M)~h(M) are
Transfer function
Difference equation
Transfer function
Difference equation
Problem 7.2
Design a three-tap FIR high-pass filter with a cutoff frequency of 1600 Hz and a sampling
rate of
8000 Hz using
Determine the transfer function and difference equation of the designed FIR system, and
compute and plot the magnitude frequency response for Ω=0, π/4, π/2, 3π/4, and π (rad).
solution
h(-M)~h(M) are
Transfer function
Difference equation
Problem 7.5
Design a five-tap FIR bandpass filter with a lower cutoff frequency of 1600 Hz, an upper
cutoff
frequency of 1800 Hz, and a sampling rate of 8000 Hz using
Determine the transfer function and difference equation of the designed FIR system, and
compute and plot the magnitude frequency response for Ω=0, π/4, π/2, 3π/4, and π (rad).
solution
h(-M)~h(M) are
Transfer function
Difference equation
Problem 7.6
Design a five-tap FIR band-reject filter with a lower cutoff frequency of 1600 Hz, an upper
cutoff
frequency of 1800 Hz, and a sampling rate of 8000 Hz using
Determine the transfer function and difference equation of the designed FIR system, and
compute and plot the magnitude frequency response for Ω=0, π/4, π/2, 3π/4, and π (rad).
solution
h(-M)~h(M) are
Transfer function
Difference equation
Problem 7.7
Given an FIR lowpass filter design with the following specifications:
Passband=0~800 Hz
Stopband=1200~4000 Hz
Passband ripple=0.1 dB
Stopband attenuation=40 dB
Sampling rate=8000 Hz
1. Window method
2. Length of the FIR filter
3. Cutoff frequency for the design equation
solution
Passband ripple
Stopband attenuation
Stopband=0~1500 Hz
Passband=2000~4000 Hz
Passband ripple=0.02 dB
Stopband attenuation=60 dB
Sampling rate=8000 Hz
1. Window method
2. Length of the FIR filter
3. Cutoff frequency for the design equation.
solution
Passband ripple
Stopband attenuation
1. Window method
2. Length of the FIR filter
3. Cutoff frequencies for the design equation
solution
Passband ripple
Stopband attenuation
Lower passband=0~1200 Hz
Stopband=1600~2000 Hz
Upper passband=2400~4000 Hz
Passband ripple=0.05 dB
Stopband attenuation=60 dB
Sampling rate=8000 Hz
1. Window method
2. Length of the FIR filter
3. Cutoff frequencies for the design equation
solution
Passband ripple
Stopband attenuation
solution
1. Transversal form
solution
To reduce this ripple effect, the modified specification with a smooth transition band
for k=0~M
for k=0~M
Sampling rate=1000 Hz
Passband=0~200 Hz
Stopband=300~500 Hz
Passband ripple=1 dB
Stopband attenuation=40 dB
Determine the error weights Wp and Ws for passband and stopband in the Packs-
McClellan
algorithm.
solution
Map
% Problem 7.19
clear; clc; close all
fs = 1000;
f = [ 0 0.4 0.6 1]; % edge frequencies
m = [ 1 1 0 0] ; % ideal magnitudes
w = [ 1 12 ]; % error weight factors [W_pass, W_stop]
b = firpm(12, f, m, w); % (12+1)Parks-McClellen algorithm and Remez
exchange
format long
vpa(b, 4)
freqz(b, 1, 512, fs) % plot the frequency response
axis([0 fs/2 -80 10]);
KEY VALUE KEY VALUE
0.03034 0.04032
-0.03153 -0.1051
0.01087 0.3023
0.4654
Problem 7.20
A bandpass FIR filter to be designed has the following specifications:
Design method: Packs-McClellan algorithm
Sampling rate=1000 Hz
Passband=200~250 Hz
Lower stopband=0~150 Hz
Upper stopband=300~500 Hz
Passband ripple=1 dB
Stopband attenuation=30 dB
Determine the error weights Wp and Ws for passband and stopband in the Packs-
McClellan
algorithm
solution
Map
-0.06725 -0.05156
0.08012 0.1148
-0.07239 -0.1604
0.02714 0.1867
Advanced Problems
Problem 7.38
The frequency response of a half-band digital differentiator is given below:
for |Ω| < π / 2:
Design the FIR differentiator with (2M+1) coefficients using the Fourier transform method
solution
Using the Fourier transform design method, we can obtain the filter coefficients below:
Problem 7.36
Speech enhancement:
A digitally recorded speech in the noisy environment can be enhanced using a lowpass
filter if the recorded speech with a sampling rate of 8000 Hz contains information within
1600 Hz.
Design a lowpass filter to remove the high-frequency noise above 1600 Hz with following
filter specifications:
Use the designed low-pass filter to filter the noisy speech and adopt the following code to
simulate the noisy speech:
load speech.dat
t=[0:length(speech)-1]*T;
th=mean(speech.speech)/4; %Noise power =(1/4) speech power
noise=sqrt(th)*randn([1,length(speech)]); %Generate Gaussian noise
nspeech=speech+noise; % Generate noisy speech
In this project, plot the speech samples and spectra for both noisy speech and the
enhanced speech and use MATLAB sound() function to evaluate the sound qualities. For
example, to hear the noisy speech:
solution
are
comment