Lecture ”Digital Signal Processing” Tutorial Nr. 3

advertisement
Lecture ”Digital Signal Processing”
Prof. Dr. D. Klakow, Rahil Mahdian
summer term 2015
Tutorial Nr. 3
Submission: 08.06.2015
—————–
Note: You are allowed to work on these Assignment sheets in groups of two students.
You have one week to solve the tutorials. The theoretical part should be submitted before
the lecture. The practical part has to be sent to your tutor in a common compressed file
format until Monday before the lecture. Make sure to include the names and matriculation numbers of all team members in the handed-in file.
For each of the Assignment sheets you can obtain 10 points in total. In order to be admitted to the exam you have to achieve 23 of the total number of points you could achieve in
all Assignment sheets (Consider there are n Assignment sheets; in order to be admitted
to the exam you need n · 10 · 23 points).
When you attend to the tutorial your points of the current Assignment sheet will be increased, by a factor of 1.5. Note that this factor will be applied personwise, not groupwise.
Your code should be well structured and documented. Do not use any Matlab toolbox if
not mentioned that you could use it. As a general guideline, you should make sure that
you are able to present your work in the Mechatronik Cip-Pool, which only has a standard
version of Matlab.
1 Exercise
Butterworth filter.
1.1 (1 P) Subtask
In order to design a discrete time lowpass filter using the Butterworth filter, you are given
the following specifications:
• 0.89125 ≤ |H(ejω )| ≤ 1
• |H(ejω )| ≤ 0.17783
• 0 ≤ |ω| ≤ 0.2π
• 0.3π ≤ |ω| ≤ π
Remember the magnitude-squared function of the Butterworth filter:
|Hc (jΩ)|2 =
1
1 + (Ω/Ωc )2N
Sketch the tolerance bounds on the magnitude of the frequency response |Hc (jΩ)| of the
continuous-time Butterworth filter, such that the above specifications are met.
1
You are allowed to design the filter using matlab. If you do so you may refer to the videos
that will be uploaded soon to the webpage. (This is just optional and not required to solve
the task).
2 Exercise
This exercise is concerned about sampling and filters. These exercises are taken from the
book Digital Signal Processing [Alan V. Oppenheim, Ronald W. Schafer] (Problem 4.5
and 4.15) respectively. So in case you encounter problems you may take a reading in
chapter 4.
2.1 (3 P) Subtask
Consider system described by the figure provided below:
xc (t)
C/D
(T)
x[n]
discretetime
system
y[n]
D/C
(T)
yr (t)
The discrete-time system here is an ideal lowpass filter with cutoff frequency π8 radians/s.
a) Suppose xc (t) is bandlimited to 5kHz. What is the maximum value of T that will
avoid aliasing in the C/D converter?
b) Suppose T1 = 10kHz. Determine the cutoff frequency of the effective continuous-time
(anti-aliasing) filter.
c) Now suppose T1 = 20kHz. Again determine the cutoff frequency of the effective
continuous-time (anti-aliasing) filter.
2.2 (3 P) Subtask
Consider the system described by the figure provided below:
H(ej ω)
3
x[n]
↑3
xd [n]
↓3
xe [n]
xr [n]
− π3
πω
3
For each of the signals x[n] provided below, determine whether it holds x[n] = xr [n].
a) x[n] = cos( πn
)
4
2
b) x[n] = cos( πn
)
2
h πn i2
sin( 8 )
c) x[n] =
πn
Hint: You don’t need to calculate explicitly the down- and upsampled signals here. Think
of when a signal remains the same after down- and upsamling or here passing the system
depicted above.
3 Exercise
Filtering in practice. In this exercise you will filter a signal in order to enhance the
perception.
3.1 (3 P) Subtask
Consider the continuous audio signal s(t) = sin(440 · t). You can imagine that this is the
target signal that you for instance wanted to record. Now we want to model this situation
in matlab:
a) Implement a matlab function createSin(freq, Fs, length), that takes as arguments the target frequency freq, the sampling rate, Fs and the duration the signal
should have in the end (in ms). createSin should return a vector containing the
samples obtained by sampling a continuous sin() with the given frequency at the
given sampling rate. Basically this function should simply sample a sin function at
the given sampling rate and return the samples as a vector.
b) Write a matlab script that samples the signal s(t) at a sampling rate of F s =
44100Hz and plays it.
c) Now consider besides your original signal s(t) you have recorded another signal
n(t) = sin(1000 · t) that has been present in the environment (your signal sn (t)
consists of the two signals s(t) and n(t) now (→ sn (t) = s(t) + n(t))). Implement a
matlab function that models this situation as in part a).
d) Write a matlab script that samples the signal sn (t) at a sampling rate of F s =
44100Hz and plays it.
e) As you can hear from your implementation in part d) this is a very unsatisfying
result, when considering that you actually wanted to record a signal as it sounds in
part b). Using the matlab filter toolbox design a filter that reconstructs your desired
signal s(t) from your distorted signal sn (t). Report the settings that you chose with
a brief explanation why you did so 1 .
f) Export your filter that you designed in part e) as a matlab function. Write a script
that applies your filter to your distorted signal from part d) and play it 2 .
1
2
The toolbox can be started by typing fdatool to the matlabs command line.
You are allowed to use the matlabs filter() function here.
3
4 Bonus
4.1 (2 P) Subtask
Consider the following two systems T1 and T2 :
• T1 :
x(n)
↑M
↓N
↓N
↑M
y(n)
• T2 :
x(n)
y(n)
Under which conditions are the two systems equivalent? In other words what have
M and N to satisfy in order to become interchangeable, i.e. T1 and T2 produce the
same output?
You may assume that no information is lost during the downsampling.
This question has already been formulated in lecture 4, slide 7.
4
Download