HW 6 ECE--无代写
时间:2024-03-09
HW 6 ECE-GY 6113 - DSP 1
Submit on Brightspace Spring 2024
Part A
• Baseline Drift Correction
• Notch Filter (Gain) Exercise
• Peaking Filter Exercise
Part B
• Ideal Discrete-time Differentiator
• Ideal Fractional Delay System
Part C
1) Given the impulse response h(n), the impulse response of a new system is given by
g(n) = (-1)^n h(n).
(a) Find a simple expression relating G(z) to H(z). Show your derivation.
(b) Find the poles and zeros of G in terms of the poles and zeros of H.
(c) Find a simple expression relating Gf(⍵) to Hf(⍵). Show your derivation.
(e) Illustrate (a), (b), (c) with an example LTI system of your choice.
2) Consider the LTI system implemented by the difference equation
y(n) = (1/6) [ x(n) - x(n-1) + x(n-2) - x(n-3) + x(n-4) - x(n-5) ]
Find and sketch the impulse response, the pole-zero diagram, and frequency response. What is
the dc gain of this system? Express the frequency response in terms of the digital sinc function.
What kind of filter is this (low-pass, high-pass, band-pass, or band-stop filter?)
3) Exercise 3.18 (in “DSP Exercises.pdf”)
Part X [do not submit]
A simple form of signal smoothing can be performed by applying a K-point moving average
twice. Let K = 6. Consider a system implemented by running a signal twice through the K-point
moving average. That is, the filter consists of two K-point moving average systems in cascade.
Find and sketch the impulse response, dc gain, pole-zero diagram, and frequency response.
Baseline Drift Correction
Design and use a dc notch filter to correct the baseline drift in an ECG signal.
Download the accompanying file ecg_lfn.txt containing ECG data,
shown in the plot below. The sampling frequency is 1000 samples/second.
Design a first-order recursive dc notch filter to remove the baseline drift. The
frequency response of the system should have a null at dc (Hf (0) = 0). The
transfer function of the filter should have a pole on the positive real axis.
Apply your dc notch filter to the ECG data to remove the baseline drift. Try
not to distort the ECG signal itself. The output signal should have a baseline
value around zero. Evaluate the e↵ectiveness of the filter by overlaying the
input and output signal in the same plot. Submit a writeup comprising your
description of the filter, plots of the frequency response, pole-zero diagram,
impulse response, and input-output signals. Comment on the e↵ect of the
pole position.
0 1 2 3 4 5 6 7 8 9 10
Time (sec)
-3
-2
-1
0
1
2
3
ECG signal, it has a baseline drift
0 0.5 1 1.5 2 2.5 3
Time (sec)
-3
-2
-1
0
1
2
3
Detail
1
Notch Filter (Gain) Exercise
A second-order recursive notch filter is illustrated
in Fig. 1. The filter has a null at the frequency 0.05
cycles/sample (equivalently, 0.1⇡ radians/sample).
The poles have a modulus of 0.9. The filter is nor-
malized so the dc gain is unity, as evident in the
plot. But the gain on the high-frequency side ex-
ceeds unity, reaching 1.11.
Task: Design a third-order recursive notch filter
with a null at the same frequency. The new fil-
ter should have a gain of unity at both f = 0 and
f = 0.5 cycles/sample. The di↵erence equation
should have real-valued coecients. There is more
than one correct solution. The frequency response
magnitude of one solution is illustrated in Fig. 2.
To submit: Mathematical derivation, di↵erence
equation coecients, pole-zero diagram, frequency
response magnitude, and Matlab code.
−1.5 −1 −0.5 0 0.5 1 1.5
−1
−0.5
0
0.5
1
Real Part
Im
ag
in
ar
y
Pa
rt
Pole/zero diagram
0 0.1 0.2 0.3 0.4 0.5
0
0.2
0.4
0.6
0.8
1
1.2
Frequency (cycles/sample)
Magnitude response
Figure 1: Second-order recursive notch filter with
notch at 0.05 cycles/sample.
0 0.1 0.2 0.3 0.4 0.5
0
0.2
0.4
0.6
0.8
1
1.2
Frequency (cycles/sample)
Magnitude response
Figure 2: Third-order recursive notch filter with
unity gain on both sides of the null.
1
Peaking Filter Exercise
The magnitude response of a second order recursive filter is shown in this figure. The
peak is at 0.2 pi radians/sample (0.1 cycles/sample).
This filter is similar to the second order recursive notch filter. But, instead of attenuating
a given frequency, this filter amplifies a given frequency. This is a peaking filter. How
should the poles and zeros of the notch filter be modified to achieve amplification
instead of attenuation?
Design a second-order recursive filter having a frequency response magnitude like the
one in the figure. It does not have to be identical, but it should have a peak at 0.1
cycles/samples and it should be relatively flat away from that frequency. In MATLAB,
plot the pole/zero diagram, impulse response, and frequency response of your second-
order filter.
0 0.1 0.2 0.3 0.4 0.5
0
0.2
0.4
0.6
0.8
1
Frequency (cycles/sample)
Magnitude response
Ideal Discrete-time Di↵erentiator
Di↵erentiation can be considered an LTI system. (The derivative of a trans-
lated signal is the translation of the derivative of a signal. And the sum of
derivatives of two signals is the derivative of their sum.) Therefor, we can
consider the frequency response of the di↵erentiator.
The ideal discrete-time di↵erentiator has a frequency response of
Hf (!) = j! for |!| < ⇡. (1)
1. What is the derivative of the function x(t) = cos(!t)? Based on this
and the frequency response concept, explain why the frequency re-
sponse of the ideal di↵erentiator is given by equation (1).
2. Without computing the impulse response, determine from Hf (!) if the
impulse response is real-valued or not. Explain.
3. Use the inverse discrete-time Fourier transform (DTFT) to derive the
impulse response of the ideal di↵erentiator.
4. Sketch the magnitude |Hf (!)| and phase (angle) of the frequency re-
sponse Hf (!) of the ideal di↵erentiator for |!| < 2⇡.
5. Can the ideal di↵erentiator be implemented as a di↵erence equation?
Explain.
6. Truncate the ideal impulse response to make it FIR. Use Matlab to
apply your filter to the following signal. Show your code and plots,
and explain your observations.
>> u = @(n) double(n >= 0); % step signal
>> n = -20:500;
>> x = sin(0.001 * n.^2) .* (u(n) - u(n-400));
1
Ideal Fractional Delay System
The ideal fractional delay system for discrete-time signals is an LTI with frequency response
Hf (!) = ej⌧!, for |!| < ⇡. (1)
This system delays the input signal by ⌧ samples. The value of ⌧ does not have to be an
integer.
1. Sketch the frequency response magnitude and phase for |!| < 2⇡.
2. Use the inverse discrete-time Fourier transform (DTFT) to find the impulse response
of the ideal fractional delay system with parameter ⌧ .
3. Can the ideal fractional delay system be implemented using a di↵erence equation?
Explain.
1
3.16
V
ery
sim
p
le
h
igh
-p
ass
d
igital
fi
lterin
g
can
b
e
p
erform
ed
by
th
e
d
i↵
eren
ce
equ
ation
:
y(n
)
=
1N
N

1
Xk
=
0
(
1)
k
x
(n
k
)
w
h
ere
x
(n
)
is
th
e
sign
al
b
ein
g
fi
ltered
.
In
th
e
follow
in
g,
assu
m
e
N
=
8.
(a)
S
ketch
th
e
im
p
u
lse
resp
on
se
of
th
is
h
igh
-p
ass
fi
lter.
(b
)
W
h
at
is
th
e
d
c
gain
of
th
e
fi
lter?
T
h
at
m
ean
s,
fi
n
d
H
f(0).
(c)
F
in
d
th
e
zeros
of
th
e
tran
sfer
fu
n
ction
an
d
sketch
th
e
p
ole/zero
d
ia-
gram
.
(d
)
B
ased
on
th
e
zero
d
iagram
in
(c),
sketch
th
e
frequ
en
cy
resp
on
se
am
-
p
ltu
d
e
A
(!
)
(th
is
is
a
lin
ear-p
h
ase
F
IR
fi
lter)
an
d
th
e
frequ
en
cy
re-
sp
on
se
m
agn
itu
d
e|H
f(!
)|.
3.17
V
ery
sim
p
le
sign
al
sm
ooth
in
g
can
b
e
p
erform
ed
by
a
m
ovin
g
average
of
N
con
secu
tive
sam
p
les,
v(n
)
=
1N
N

1
Xk
=
0
x
(n
k
)
w
h
ere
x
(n
)
is
th
e
in
p
u
t
sign
al.
In
th
e
follow
in
g,
assu
m
e
N
=
6.
C
on
sid
er
a
fi
lter
im
p
lem
ented
by
ru
n
n
in
g
a
sign
al
tw
ice
th
rou
gh
th
e
N
-p
oint
m
ovin
g
average.
T
h
at
is,
th
e
fi
lter
con
sists
of
tw
o
N
-p
oint
m
ovin
g
average
system
s
in
cascad
e.
(a)
S
ketch
th
e
im
p
u
lse
resp
on
se
h
(n
)
of
th
e
total
fi
lter.
(b
)
W
h
at
is
th
e
d
c
gain
of
th
e
total
fi
lter?
T
h
at
m
ean
s,
fi
n
d
H
f(0).
(c)
F
in
d
th
e
zeros
of
th
e
tran
sfer
fu
n
ction
an
d
accu
rately
sketch
th
e
p
ole/zero
d
iagram
.
(d
)
B
ased
on
th
e
zero
d
iagram
in
(c),
sketch
th
e
frequ
en
cy
resp
on
se
m
ag-
n
itu
d
e|H
(!
)|.
3.18
C
on
sid
er
a
fi
lter
im
p
lem
ented
u
sin
g
th
e
d
i↵
eren
ce
equ
ation
,
y(n
)
=
x
(n
)
x
(n
N
)
+
y(n
1)
w
h
ere
x
(n
)
is
th
e
sign
al
b
ein
g
fi
ltered
.
(a)
F
in
d
th
e
zeros
of
th
e
tran
sfer
fu
n
ction
an
d
sketch
th
e
p
ole/zero
d
ia-
gram
.
(b
)
B
ased
on
th
e
p
ole-zero
d
iagram
,
rou
gh
ly
sketch
th
e
frequ
en
cy
resp
on
se
m
agn
itu
d
e|H
(!
)|.
E
xp
licitly
in
d
icate
any
frequ
en
cy
resp
on
se
nu
lls
if
th
ere
are
any.
(c)
S
ketch
th
e
im
p
u
lse
resp
on
se
of
th
e
fi
lter.
(d
)
W
h
at
is
th
e
d
c
gain
of
th
e
fi
lter?
3.19
T
h
e
tran
sfer
fu
n
ction
H
(z)
of
an
F
IR
fi
lter
h
as
zeros
in
th
e
z-p
lan
e
as
illu
strated
.
W
N
N
=
12
T
h
e
zeros
on
th
e
u
n
it
circle
are
at
p
ow
ers
of
W
1
2 .
T
h
e
d
c-gain
of
th
e
fi
lter
is
2.
A
ll
th
e
p
oles
are
at
z
=
0.
(a)
A
ccu
rately
sketch
th
e
im
p
u
lse
resp
on
se
of
th
e
fi
lter.
(b
)
S
ketch
th
e
frequ
en
cy
resp
on
se
m
agn
itu
d
e|H
(e
j
!
)|.
A
ccu
rately
in
d
i-
cate
th
e
nu
lls
of
th
e
frequ
en
cy
resp
on
se.
(c)
S
ketch
th
e
p
h
ase
of
th
e
frequ
en
cy
resp
on
se
\
H
(e
j
!
).
3.20
T
h
e
tran
sfer
fu
n
ction
H
(z)
of
an
F
IR
fi
lter
h
as
13
zeros
in
th
e
z-p
lan
e
as
illu
strated
.
exp
(j
⇡6
)
0
.5
2
.0
T
h
e
zeros
on
th
e
u
n
it
circle
are
at
p
ow
ers
of
W
1
2 .
T
h
e
d
c-gain
of
th
e
fi
lter
is
u
n
ity.
A
ll
th
e
p
oles
are
at
z
=
0.
(a)
A
ccu
rately
sketch
th
e
im
p
u
lse
resp
on
se
of
th
e
fi
lter.
(b
)
S
ketch
th
e
frequ
en
cy
resp
on
se
m
agn
itu
d
e|H
(e
j
!
)|.
A
ccu
rately
in
d
i-
cate
th
e
nu
lls
of
th
e
frequ
en
cy
resp
on
se.
(c)
S
ketch
th
e
p
h
ase
of
th
e
frequ
en
cy
resp
on
se
\
H
(e
j
!
).
25

学霸联盟
essay、essay代写