Schets eener parlementaire geschiedenis van Nederland van 1849

advertisement
et 4235 - Digital signal processing
Class 8: Matlab examples
Rocio Arroyo Valles, Geert Leus, and Alle-Jan van der Veen
01-10-2014 – Faculty of EEMCS, Delft University of Technology
Delft
University of
Technology
Challenge the future
Outline
• Exercise 1- Part A: generation and analysis of random noise signals
• Exercise 1- Part B: filtering of random processes
• Exercise 2: Design of elementary digital filters. Filtering and analysis of
random noise signals
• Exercise 3: filter design for interference cancellation in speech
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
2
Exercise 1 – Part A
Generation and analysis of random noise signals
• Background [Hayes, Sec. 3.3.7]:
A white noise signal v(n) is characterized by an impulse
autocorrelation function (ACF)
and a flat power spectral density (PSD)
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
3
Exercise 1 – Part A
Generation and analysis of random noise signals
• MATLAB Exercise:
1.
Generate and plot 1000 samples of zero mean unit variance white noise, x(n)
2.
Calculate and plot the sample ACF for |lag|<100,rˆx (k ). What three properties
do you expect on an autocorrelation sequence and are these satisfied here?
3.
Calculate and plot the PSD. Plot the magnitude in dB and the frequency axis in
the interval [0, 2π]
4.
Are the results as expected, according to the theory seen in class?
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
4
Exercise 1 – Part B
Filtering of random processes
• Background [Hayes, Sec. 3.4]:
Filtering a signal x(n) in a filter with impulse response h(n) yields
The autocorrelation of the output process y(n) can be computed
In the frequency domain, the power spectrum can be calculated as
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
5
Exercise 1 – Part B
Filtering of random processes
• MATLAB Exercise – Section 1:
1.
Generate and plot 1000 samples of zero mean unit variance white noise, x(n)
2.
Filter x(n) with a FIR filter [1,2,1], so that y(n) is related to x(n) by the
convolution sum: y(n)=x(n)*h(n).
3.
From y(n), calculate and plot the sample ACF of y(n) for |lag|<100, rˆy (k ).
4.
Calculate and plot the PSD. Plot the magnitude in dB and the frequency axis in
the interval [0, 2π]
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
6
Exercise 1 – Part B
Filtering of random processes
• MATLAB Exercise – Section 2:
1.
2.
3.
4.
5.
Generate and plot 1000 samples of zero mean unit variance white noise, x(n)
Compute the sample ACF for |lag|<100,rˆx (k ).
Considering the same FIR filter, plot rh(k)=h(k)*h*(-k), the deterministic
autocorrelation function of the unit sample response h(n), and its spectrum.
Calculate
and plot the PSD of y(n) as derived from rˆy (k )
Verify the properties:
1. If h(n) is finite in length and zero outside the interval [0,N-1], then the
variance (power) of y(n) may be expressed in terms of the autocorrelation
matrix of x(n), Rx, and the vector of coefficients h as: σ2y=hHRxh.
2. The variance of the output process is σ2y=ry(0)
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
7
Exercise 1 – Part B
Filtering of random processes
• MATLAB Exercise – Section 3:
1.
Generate and plot 1000 samples of zero mean unit variance white noise, x(n)
2.
Compute the PSD of x(n)
3.
Compute H(ejω) for the FIR filter
4.
Compute and plot the PSD of y(n) as Py(ejω)= Px(ejω)| H(ejω)|2
Are the results obtained from the three sections the same?
What happens when the number of samples of x(n) tends to infinity?
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
8
Exercise 2
Design and analysis of elementary digital filters
• Background [Hayes, Sec. 3.6]:
First-and second-order all-zero filters: H(z) = b0 + b1z-1 + b2z-2
BANDSTOP
2
Im b1 <4b0b2
b2≠0
LOWPASS
b1/b0>0
Im
b2=0
HIGHPASS
b1/b0<0
Im
b2=0
ω
ω
ω
Re
Re
|H|
|H|
ω
Digital signal processing – Class 8
Re
|H|
ω
Arroyo Valles, Leus & van der Veen
ω
9
Exercise 2
Design and analysis of elementary digital filters
• Background [Hayes, Sec. 3.6]:
First-and second-order all-pole filters: H(z) = b0 /(1 + a1z-1 + a2z-2)
BANDPASS
a12<4a2
Im
a2≠0
x
LOWPASS
a1<0
Im
a2=0
ω
ω
x
HIGHPASS
a1>0
Im
a2=0
Re
x
Re
|H|
|H|
ω
Digital signal processing – Class 8
x
ω
Re
|H|
ω
Arroyo Valles, Leus & van der Veen
ω
10
Exercise 2
Design and analysis of elementary digital filters
• Background [Hayes, Sec. 3.6]:
Biquadratic filters: H(z) = (b0 + b1z-1 + b2z-2)/(1 + a1z-1 + a2z-2)
Special case:
b0 = 1
b1 = -2rzcos(ωc)
b2 = rz2
a1 = -2rpcos(ωc)
a2 = rp2
BANDPASS
rz<rp
Im
BANDSTOP
rz>rp
Im
x
x
ω
x
Re
|H|
ω
x
Re
|H|
ω
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
ω
11
Exercise 2
Design of elementary digital filters. Filtering and
analysis of random noise signals
• MATLAB Exercise:
1.
2.
Generate and plot 1000 samples of zero mean unit variance white noise
Calculate and plot the PSD
3.
4.
Design a highpass filter with one zero at z=0.9
Plot the pole-zero diagram in the complex plane and the frequency magnitude
response
Filter the white noise signal using the highpass filter
Calculate and plot the PSD of the resulting output signal
5.
6.
Design a bandpass filter with central frequency ωc=1 rad, rz = 0.1, rp = 0.9
Plot the pole-zero diagram in the complex plane and the frequency magnitude
response
9. Filter the white noise signal using the bandpass filter
10. Calculate and plot the PSD of the resulting output signal
7.
8.
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
12
Exercise 3
Spectrogram
Common representation of the voice signal
Horizontal axis represents time, the vertical axis is frequency
The amplitude is represented by the intensity or colour
Wideband spectrogram (32 samples)
Narrowband spectrogram (512 samples)
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
13
Exercise 3
Filter design for interference cancellation in speech
• MATLAB Exercise:
1.
2.
3.
Read the sound file speech_dft.wav (included in Simulink DSP Blockset)
into a vector in the MATLAB workspace
Filter the sound signal with the filter
H(z) = 1/(0.84 + 0.26z-1 - 0.31z-2 + 0.13z-4 + 0.18z-5 - 0.29z-6 + 0.18z-7)
This is an unstable filter which causes a sinusoidal oscillation in the speech
signal (acoustic feedback)
Analyze the speech signal corrupted with acoustic feedback, and design an
appropriate bandstop filter that is capable of cancelling the sinusoidal
oscillation while affecting the speech signal as little as possible
Digital signal processing – Class 8
Arroyo Valles, Leus & van der Veen
14
Download
Related flashcards
Create Flashcards