Signal and Linear System Analysis
Signal and Linear System Analysis
Contents
2.1 Signal Models . . . . . . . . . . . . . . . . . . . . . 2-3
2.1.1 Deterministic and Random Signals . . . . . . 2-3
2.1.2 Periodic and Aperiodic Signals . . . . . . . . 2-3
2.1.3 Phasor Signals and Spectra . . . . . . . . . . 2-4
2.1.4 Singularity Functions . . . . . . . . . . . . . 2-7
2.2 Signal Classifications . . . . . . . . . . . . . . . . . 2-11
2.3 Generalized Fourier Series . . . . . . . . . . . . . . 2-14
2.4 Fourier Series . . . . . . . . . . . . . . . . . . . . . 2-20
2.4.1 Complex Exponential Fourier Series . . . . . 2-20
2.4.2 Symmetry Properties of the Fourier Coeffi-
cients . . . . . . . . . . . . . . . . . . . . . 2-23
2.4.3 Trigonometric Form . . . . . . . . . . . . . 2-25
2.4.4 Parseval’s Theorem . . . . . . . . . . . . . . 2-26
2.4.5 Line Spectra . . . . . . . . . . . . . . . . . 2-26
2.4.6 Numerical Calculation of Xn . . . . . . . . . 2-30
2.4.7 Other Fourier Series Properties . . . . . . . . 2-37
2.5 Fourier Transform . . . . . . . . . . . . . . . . . . . 2-38
2-1
CONTENTS
x.t / D x.t; i /
Q / D Ae j.!0tC/;
x.t 1<t <1
Q
(a) obtain x.t/ from x.t/, Q
(b) obtain x.t/ from x.t/ and xQ .t/
We can also turn this around using the inverse Euler formula
x.t / D A cos.!0t C /
1 1
Q / C xQ .t /
D x.t
2 2
j.!0 t C/ j.!0 tC/
Ae C Ae
D
2
Amplitude 12
2
f (Hz)
-100 -10 10 100
5π/8
π/3
Phase
f (Hz)
-π/3
-5π/8
Properties:
1. ı.at / D ı.t /=jaj
2. ı. t / D ı.t /
3. Sifting property special cases
8
<x.t0/; t1 < t0 < t2
Z t2 ˆ
ˆ
x.t /ı.t t0/ dt D 0; otherwise
t1 ˆ
:undefined; t0 D t1 or t0 D t2
ˆ
4. Sampling property
x.t /ı.t t0/ D x.t0/ı.t t0/
for x.t / continuous at t D t0
5. Derivative property
Z t2
x.t /ı .n/.t t0/ dt D . 1/nx .n/.t0/
t1
n
ˇ
n d x.t / ˇ
D . 1/ n
ˇ
dt ˇtDt0
Note: Dealing with the derivative of a delta function re-
quires care
A test function for the unit impulse function helps our intuition
and also helps in problem solving
Two functions of interest are
(1
1 t ; jt j
ı .t / D … D 2
2 2 0; otherwise
t 2
1
ı1 .t / D sin
t
2-8 ECE 5625 Communication Systems I
2.1. SIGNAL MODELS
Test functions for the unit impulse ı.t/: (a) ı .t/, (b) ı1 .t/
also
du.t /
ı.t / D
dt
Consider Z 1
x.t /ı 0.t / dt
1
Signal Classes:
For ˛ D 0 we have
1 2 A2
P D lim A T D
T !1 2T 2
2-12 ECE 5625 Communication Systems I
2.2. SIGNAL CLASSIFICATIONS
The set fE
a1; aE2; aE3g forms a basis for the three dimensional
space
Now let fE
a1; aE2; aE3g form an orthogonal basis, which implies
that
aEi aEj D .Eai ; aEj / D hE
ai ; aEj i D 0; i ¤ j
which says the basis vectors are mutually orthogonal
From analytic geometry (and linear algebra), we know that we
can find a representation for AE as
.E E
a1 A/ a2 A/
.E E a3 A/
.E E
E
AD C C
a1j2
jE a 2 j2
jE a 3 j2
jE
2-14 ECE 5625 Communication Systems I
2.3. GENERALIZED FOURIER SERIES
where
aEi AE
ci D ; i D 1; 2; 3
ai j2
jE
is the component of AE in the aEi direction
– Note that the first two terms are independent of the Xn’s
and the last term is nonnegative (missing steps are in text
homework problem 2.14)
Summary
1
X
x.t / D l.i.m. Xnn.t /
nD1
1
Z
Xn D x.t /n.t / dt
cn T
x(t) φ1(t)
1 1
0.75 0.75
0.5 0.5
0.25 0.25
-0.5 -0.5
-0.75 -0.75
-1 -1
φ2(t) φ3(t)
1 1
0.75 0.75
0.5 0.5
0.25 0.25
-0.5 -0.5
-0.75 -0.75
-1 -1
x(t)
1
0.75
xa(t) 2/π
0.5
0.25
Functional approximation
Z ˇ 3
X ˇ2
ˇ ˇ
N D ˇx.t /
ˇ Xnn.t /ˇˇ dt
T nD1
Z 3
X
2
D jx.t /j dt cnjXnj2
T nD1
1 ˇˇ 2 ˇˇ2 1 ˇˇ 2 ˇˇ2 1 ˇˇ 2 ˇˇ2
ˇ ˇ ˇ ˇ ˇ ˇ
1
D
2 4 ˇ ˇ 2 ˇ ˇ 4 ˇ ˇ
ˇ ˇ2
1 ˇ2ˇ
D ˇ ˇ D 0:0947
2 ˇ ˇ
proof of orthogonality
Z t0CT0 Z t0CT0
jm 2 t 2
jn T t j 2 .m n/t
m.t /; n.t / D e T0 e 0 dt D e T0 dt
8t0R t0
t0 CT0
ˆ
<Rt0
ˆ dt; mDn
t0 CT0
D t0 cosŒ2.m n/t =T0
ˆ
: Cj sinŒ2.m n/t =T0 dt; m ¤ n
ˆ
(
T0 ; m D n
D
0; m ¤ n
We also conclude that cn D T0
Note that
hav1.t / C bv2.t /i D ahv1.t /i C bhv2.t /i;
where a and b are arbitrary constants
1. Xn D X n
2. jXnj D jX nj
3. †Xn D †X n
proof
1
Z
Xn D x.t /e j n!0t dt
T0 T0
1
Z
D x.t /e j. n/!0t dt D X n
T0 T0
since x .t / D x.t /
Xn D 0 for n even
Consider
t0 DT0 =2 t0 CT0
1 1
Z Z
j n!0 t 0
Xn D x.t /e j n!0t dtC x.t 0/e dt 0
T0 t0 T0 t0 CT0 =2
t0 CT0 =2
1
Z
j n!0 t
Xn D x.t /e dt
T0 t0
tCT0 =2
1
Z
j n!0 .t CT0 =2/
C x.t T0=2/ e dt
T0 t0 „ ƒ‚ …
x.t/
1 Z t0 CT0 =2
j n!0 T0 =2 j n!0 t
D 1 e x.t /e dt
T0 t0
We thus see that the even indexed Fourier coefficients are in-
deed zero under odd half-wave symmetry
since cos.x/ D .e jx C e jx
/=2
where
An D 2hx.t / cos.n!0t /i
Bn D 2hx.t / sin.n!0t /i
Consider
2 A A
x.t / D A cos .2f0t C / D C cos 2.2f0/t C 21
2 2
A A A
D C e j 21 e j 2.2f0/t C e j 21 e j 2.2f0/t
2 4 4
Double-
Sided
-2f0
f f
-2f0 2f0 2f0
Single-
Sided
f f
2f0 2f0
x(t)
A
... ...
t
-2T0 -T0 0 τ T0 T0 + τ
sin.x/
sinc.x/ D
x
2-28 ECE 5625 Communication Systems I
2.4. FOURIER SERIES
Finally,
A j.nf0 /
Xn D sinc.nf0 /e ; n D 0; ˙1; ˙2; : : :
T0
A
jXnj D jsincŒ.nfo/ j
T
80
< .nf0/; sinc.nfo / > 0
ˆ
ˆ
†Xn D .nf0/ C ; nf0 > 0 and sinc.nf0 / < 0
ˆ
: .nf0/ ; nf0 < 0 and sinc.nf0 / < 0
ˆ
At f0 = 0.125 f0 = 1, t = 0.125
1 t =8
Phase slope = -p f t
= -0.125´ p f
By definition
1
Z
j 2kf0 t
Xk D x.t /e dt; k D 0; ˙1; ˙2; : : :
T0 T0
Note that the above must be evaluated for each Fourier coeffi-
cient of interest
– For k small and x.t / smooth in the sense that the harmon-
ics rolloff quickly, N on the order of 100 may be adequate
– For k moderate, say 5–50, N will have to become in-
creasingly larger to maintain precision in the numerical
integral
In summary
(
X Œk=N; 0 k N=2
Xk '
X ŒN k=N; N=2 k < 0
t
0 tr τ τ + tr T0
Shown above is one period of a finite rise and fall time pulse
train
xp[k] = 1
elif (t[k] > tau and t[k] < T1):
xp[k] = -t[k]/tr + 1 + tau/tr;
else:
xp[k] = 0
return xp, t
We now plot the double-sided line spectra for D 1=8 and two
values of rise-time tr
1/20
1/8
Sidelobes smaller
than ideal pulse train 1/τ = 8
which has zero rise
time
1/10
1/8
Sidelobes smaller
than with tr = 1/20 1/τ = 8
case ~10dB
more
Likewise if
y.t / D x.t t0 /
it follows that
j 2.nf0 /t0
Yn D X n e
proof:
j 2.nf0 /t
Yn D hx.t t0/e i
Let D t t0 which implies also that t D C t0, so
j 2.nf0 /.Ct0 /
Yn D hx./e i
j 2.nf0 / j 2.nf0 /t0
D hx./e ie
j 2.nf0 /t0
D Xn e
QED
Note that
Z 1
RefX.f /g D x.t / cos 2f t dt
1
Z 1
ImfX.f /g D x.t / sin 2f t dt
1
thus
jX. f /j D jX.f /j (even in frequency)
†X. f / D †X.f / (odd in frequency)
ECE 5625 Communication Systems I 2-39
CONTENTS
Additionally,
but
Z 1 Z 1
x .t /e j 2f t dt D x.t /e j 2f t
dt D X .f /
1 1
Finally,
Z 1 Z 1
2
ED jx.t /j dt D jX.f /j2 df
1 1
(Aτ)12
0.8 Energy
G(f) = |X(f)|2 Spectral
0.6
Density
0.4
0.2
f
?3 ?2
-2/τ ?1
-1/τ 0 1/τ1 2
2/τ 3
Superposition Theorem
F
a1x1.t / C a2x2.t / ! a1X1.f / C a2X2.f /
proof:
so
F x.t /e j 2f0t D X.f
˚
f0 /
QED
Modulation Theorem
The modulation theorem is an extension of the frequency trans-
lation theorm
F1 1
x.t / cos.2f0t / ! X.f f0/ C X.f C f0/
2 2
ECE 5625 Communication Systems I 2-43
CONTENTS
1 1
cos.2f0t / D e j 2f0t C e j 2f0 t
2 2
Then apply the frequency translation theorem to each term sep-
arately
signal
X(f) multiplier
A Y(f)
x(t) y(t)
A/2
f f
0 -f0 0 f0
cos(2πf0t)
A simple modulator
Duality Theorem
Note that
Z 1 Z 1
j 2f t
FfX.t /g D X.t /e dt D X.t /e j 2. f /t
dt
1 1
f
-W 0 W
Differentiation Theorem
The general result is
d nx.t / F
n
! .j 2f /n X.f /
dt
proof: For n D 1 we start with the integration by parts formula,
R ˇ R
u dv D uv ˇ v du, and apply it to
ˇ
Z 1
dx dx j 2f t
F D e dt
dt 1 dt
ˇ1 Z 1
D x.t /e j 2f t ˇ Cj 2f x.t /e j 2f t dt
ˇ
1
„ ƒ‚ … „ 1 ƒ‚ …
0 X.f /
t
−τ 0 τ
Note that
1/τ
1/τ
τ
t t
−τ −τ τ
-1/τ -2/τ
For this example four cases are needed for t to cover the entire
time axis t 2 . 1; 1/
D t C =2 C =2 D C t
x2(t - λ) x1(λ)
Overlap begins when t
+ τ/2 = -τ/2 or t = -τ
λ
−τ/2 0 τ/2
t + τ/2
x1(λ) x2(t - λ)
λ
−τ/2 0 τ/2 t + τ/2
t - τ/2
x1(λ) x2(t - λ)
λ
−τ/2 0 τ/2 t - τ/2 t + τ/2
Final summary,
t t t
… … D ƒ
or
t F
ƒ ! sinc2.f /
No overlap
λ
t 0
λ
0 t
Summary,
A ˛t
y.t / D 1 e u.t /
˛
A/α
y(t)
t
0
Multiplication Theorem
We can write
x.t / D lim A….t =T /
T !1
Note that
˚
F A….t =T / D AT sinc.f T /
1 AT1 1 AT2
0.8 0.8
0.6 0.6 T2 >> T1
0.4 0.4
0.2 0.2
f f
?3 ?2 ?1 1 2 3 ?3 ?2 ?1 1 2 3
? 0.2 ? 0.2
Increasing T in AT sinc.f T /
As a further check
Z 1 ˇ
F 1 Aı.f / D Aı.f /e j 2ff t df D Ae j 2f t ˇ
˚
DA
ˇ
1 f D0
we can write
1
" #
X
X.f / D F Xne j 2 nf0t
nD 1
1
X n o
j 2 nf0 t
D XnF e
nD 1
X1
D Xnı.f nf0/
nD 1
Mathematically,
Convert to
time domain
Line
Spectra Sum phasors
Convert to
time domain
Integrate impulses to
Continuous
get phasors via the
Spectra
inverse FT
In particular
1 1
Z
j 2.nfs /t
Yn D ı.t /e dt D D fs ; any n
Ts Ts Ts
The FT of ys .t / is given by
1
X 1
X
˚ j 2 nf /t
Ys .f / D fs F e 0 D fs ı.f nfs /
nD 1 nD 1
Summary,
1 1
X F X
ı.t mTs / ! fs ı.f nfs /
mD 1 nD 1
ys(t)
1
... ...
t
-Ts 0 Ts 4Ts
Ys(f)
fs
... ...
f
-fs 0 fs 4fs
where P .f / D Ffp.t /g
x(t)
2
... 1 ...
t
-2 -1 0 1 2 T0 = 10
P .f / D 2sinc.2f / C 4sinc.4f /
j 2.nfs /t F
e ! ı.f nfs /
by writing
1 1
( )
X X
1
F fs P .nfs /ı.f nfs / D fs P .nfs /e j 2.nfs /t
nD 1 nD 1
1 1
S.f / D A2ı.f f0/ C A2ı.f C f0/
4 4
basis)
D F 1 X.f / F 1 X .f /
˚ ˚
F
but x. t / ! X .f / for x.t / real, so
Z 1
. / D x.t / x. t / D x.t /x.t C / d
1
or Z T
. / D lim x.t /x.t C / d
T !1 T
Observe that ˚
G.f / D F . /
The autocorrelation function (ACF) gives a measure of the
similarity of a signal at time t to that at time t C ; the co-
herence between the signal and the delayed signal
X(f)
G(f) = |X(f)|2
x(t)
φ(τ) =
Rx . / D hx.t /x.t C /i
Z T
1
D lim x.t /x.t C / dt
T !1 2T
Z T
if periodic 1
D x.t /x.t C / dt
T0 T0
Note that
Z 1
2
Rx .0/ D hjx.t /j i D Sx .f / df
1
F
and since for energy signals . / ! G.f /, a reasonable
assumption is that
F
Rx . / ! Sx .f /
The last two terms are zero since hcos..!1 ˙ !2/t /i D 0 when
f1 ¤ f2 (why?), hence
Clock
Period = T
C C C
D1 Q1 D2 Q2 D3 Q3 x(t)
M = 23 - 1 = 7
x(t)
+A
t
-A
one period = MT
Rx(τ) A2
... MT ...
-T T
τ
-A2/M MT
where Ts D M T
– One period of Rx . / is a triangle pulse with a level shift
Generates a sequence 0/1 bits of N_bit duration. The bits themselves are obtained
from an m-sequence of length m. Available m-sequence (PN generators) include
m = 2,3,...,12, & 16.
Parameters
----------
N_bits : the number of bits to generate
m : the number of shift registers. 2,3, .., 12, & 16
Returns
-------
PN : ndarray of the generator output over N_bits
Notes
-----
The sequence is periodic having period 2**m - 1 (2^m - 1).
Examples
--------
>>> # A 15 bit period signal nover 50 bits
>>> PN = PN_gen(50,4)
"""
c = m_seq(m)
Q = len(c)
max_periods = int(np.ceil(N_bits/float(Q)))
PN = np.zeros(max_periods*Q)
for k in range(max_periods):
PN[k*Q:(k+1)*Q] = c
PN = np.resize(PN, (1,N_bits))
return PN.flatten()
def m_seq(m):
"""
Generate an m-sequence ndarray using an all-ones initialization.
Parameters
----------
m : the number of shift registers. 2,3, .., 12, & 16
Returns
-------
c : ndarray of one period of the m-sequence
Notes
-----
The sequence period is 2**m - 1 (2^m - 1).
Examples
--------
>>> c = m_seq(5)
"""
# Load shift register with all ones to start
sr = np.ones(m)
# M-squence length is:
Q = 2**m - 1
c = np.zeros(Q)
if m == 2:
taps = np.array([1, 1, 1])
elif m == 3:
taps = np.array([1, 0, 1, 1])
elif m == 4:
taps = np.array([1, 0, 0, 1, 1])
elif m == 5:
taps = np.array([1, 0, 0, 1, 0, 1])
elif m == 6:
taps = np.array([1, 0, 0, 0, 0, 1, 1])
elif m == 7:
taps = np.array([1, 0, 0, 0, 1, 0, 0, 1])
elif m == 8:
taps = np.array([1, 0, 0, 0, 1, 1, 1, 0, 1])
elif m == 9:
taps = np.array([1, 0, 0, 0, 0, 1, 0, 0, 0, 1])
elif m == 10:
taps = np.array([1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1])
elif m == 11:
taps = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1])
elif m == 12:
taps = np.array([1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1])
elif m == 16:
taps = np.array([1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1])
else:
print ’Invalid length specified’
for n in range(Q):
tap_xor = 0
c[n] = sr[-1]
for k in range(1,m):
if taps[k] == 1:
tap_xor = np.bitwise_xor(tap_xor,np.bitwise_xor(int(sr[-1]),
int(sr[m-1-k])))
sr[1:] = sr[:-1]
sr[0] = tap_xor
return c
nD 1 mD 1
„ ƒ‚ …
n¤m terms are zero, why?
1
X
jXnj2 e j 2.nf0/t e j 2.nf0 /.tC/
˝ ˛
D
nD 1
X1
D jXnj2e j 2.nf0/
nD 1
15 bit
period
... ...
MT = 15T = 15
-1 -1
=
M 15
–1 1
Here the PSD estimate uses a 4096 point FFT and assumed
sampling rate of 10 Hz; the spectral resolution is 10/4096 =
0.002441 Hz
1
http://en.wikipedia.org/wiki/Periodogram
x(t) y(t) =
operator
Linear system block diagram
Definition
Linearity (superposition) holds, that is for input ˛1x1.t /C˛2x2.t /,
˛1 and ˛2 constants,
y.t / D H ˛1x1.t / C ˛2x2.t /
D ˛1H x1.t / C ˛2H x2.t /
D ˛1y1.t / C ˛2y2.t /
... ...
2.7.1 Stability
In signals and systems the concept of bounded-input bounded-
output (BIBO) stability is introduced
Y .f / D X.f /H.f /
2.7.3 Causality
A system is causal if the present output relies only on past and
present inputs, that is the output does not anticipate the input
The fact that for LTI systems y.t / D x.t / h.t / implies that
for a causal system we must have
h.t / D 0; t < 0
1
j ln jH.f /jj
Z
df < 1
1 1Cf2
why?
R vc(t)
x(t) y(t)
ic(t) C
X(f ) Y(f )
h(t), H(f)
RC lowpass filter schematic
x.t / D ic .t /R C y.t /
but
dvc .t / y.t /
ic .t / D c Dc
dt dt
thus
dy.t /
RC C y.t / D x.t /
dt
F
FT both sides using dx=dt ! j 2f X.f /
j 2f RC Y .f / C Y .f / D X.f /
so again
Y .f / 1
H.f / D D
X.f / 1 C jf =f3
1 1 .f =f /
Dp e j tan 3
1 C .f =f3/2
f
-f3 f3
π/2
-π/2
RC lowpass frequency response
0.8 0.8
T/
2
T/
0.6 0.6
0.4 T 0.4 RC = 2T
0.2 2T 0.2
1 1
|X(f)|, |H(f)|, |Y(f)| |X(f)|, |H(f)|, |Y(f)|
0.8 0.8
0.6 0.6
RC = T/2
0.4 0.4
RC = T/10
0.2 0.2
-3 -2 -1 1 2 3 fT -3 -2 -1 1 2 3
fT
Gy .f / D jH.f /j2 Gx .f /
and
1
X
y.t / D XnH.nf0/e j 2.nf0/t
nD 1
X1
D jXnjjH.nf0je j Œ2.nf0/t C†XnC†H.nf0/
nD 1
Distortion types:
1 d.f /
Tg .f / D
2 df
1 L
y.t / D x t
2 vp
Lossless transmission line
Note that a real transmission line does have losses that intro-
duces dispersion on a wideband signal
Ampl. Radians
2 1.5
|H(f)| H(f)
1
1.5
0.5
1
-20 -10 10 20 f (Hz)
-0.5
0.5
-1
Time Time
Tg(f) 0.015
Tp(f)
0.016
0.0125 0.015
0.01 0.014
0.0075 0.013
0.005 0.012
0.0025 0.011
f (Hz)
-20 -10 10 20 -20 -10 10 20
f (Hz)
No distortion on |f | < 10 Hz band
Specifically consider
Let
x.t / D A1 cos.!1t / C A2 cos.!2t /
Input Output
a2A1
2 a1A1 2
A1 a2A1
Non- 2 2
Linear
f f
0 f1 0 f1 2f1
a1A1A2
Input Output
Non- a2A1
2
a2A2
2
A1 Linear a1A1
a1a2A1 a1A2 2 2
2 2
A2 a2(A1 + A2)
2
f f
0 f1 f2 0 f2-f1 f1 f2 2f1 2f2
f1+f2
In particular if X.f / D A… f =.2W /
f f
Y .f / D a1A… C a22WA2ƒ
2W 2W
2-88 ECE 5625 Communication Systems I
2.7. LINEAR TIME INVARIANT (LTI) SYSTEMS
a 1A 2Wa2A2
Y( f ) = +
f f
-W W -2W 2W
a1A + 2Wa2A2
= a1A + Wa2A2
Wa2A2
f
-2W -W W 2W
Continuous spectrum in y.t/ D a1 x.t/ C a2 x 2 .t/ device
f f
-B B -B B
3. Bandpass of bandwidth B
j 2f t0
HBP.f / D Hl .f f0/ C Hl .f C f0/ e
|HBP(f)| HBP(f)
slope = -2πt0
H0
B B
f f
-f0 f0 -f0 f0
1 j 2f t0
˚
hLP.t / D F H0….f =.2B//e
D 2BH0sincŒ2B.t t0/
hLP(t) hBP(t)
2BH0
2BH0
t0
t t
t0
t0 - 1 t0 + 1
2B 2B t0 - 1 t0 + 1
2B 2B
Butterworth
A Butterworth filter has a maximally flat (flat in the sense of
derivatives of the amplitude response at dc being zero) pass-
band
Chebyshev
A Chebyshev type I filter (ripple in the passband), is is de-
signed to maintain the maximum allowable attenuation in the
passband yet have maximum stopband attenuation
Bessel
A Bessel filter is designed to maintain linear phase in the pass-
band at the expense of the amplitude response
Kn
HBE.f / D
Bn.f /
where Bn.f / is a Bessel polynomial of order n (see text) and
Kn is chosen so that the filter gain is unity at f D 0
n D 3 Amplitude response
n D 3 Group delay
You can use the filter design capability of Python with Scipy
or MATLAB with the signal processing to study lowpass, band-
pass, bandstop, and highpass filters
and when the phase jumps by +/-pi, which occurs when the
amplitude response changes sign. Since the amplitude response
is zero when the sign changes, the jumps do not alter the group
delay results.
"""
theta = np.unwrap(np.angle(H))
# Since theta for an FIR filter is likely to have many pi phase
# jumps too, we unwrap a second time 2*theta and divide by 2
theta2 = np.unwrap(2*theta)/2.
theta_dif = np.diff(theta2)
f_diff = np.diff(f)
Tg = -np.diff(theta2)/np.diff(w)
max_Tg = np.max(Tg)
#print(max_Tg)
if mode.lower() == ’groupdelay_t’:
max_Tg /= fs
plt.plot(f[:-1]*fs,Tg/fs)
plt.ylim([0,1.2*max_Tg])
else:
plt.plot(f[:-1]*fs,Tg)
plt.ylim([0,1.2*max_Tg])
plt.xlabel(’Frequency (Hz)’)
if mode.lower() == ’groupdelay_t’:
plt.ylabel(’Group Delay (s)’)
else:
plt.ylabel(’Group Delay (samples)’)
plt.title(’Frequency Response - Group Delay’)
else:
s1 = ’Error, mode must be "dB", "phase, ’
s2 = ’"groupdelay_s", or "groupdelay_t"’
print(s1 + s2)
freqs_resp(b,a=[1],Dmin=1,Dmax=5,mode=’dB’,Npts=1024,fsize=(6,4))
b =
ndarray of numerator coefficients
a =
ndarray of denominator coefficents
Dmin =
start frequency as 10**Dmin
Dmax =
stop frequency as 10**Dmax
mode =
display mode: ’dB’ magnitude, ’phase’ in radians, or
’groupdelay’, all versus log frequency in Hz
Npts = number of points to plot; defult is 1024
5th-Order-
Cheby1 BPF
Digital
fs = 1000 Hz
Highly peaked
near the band-
edge, even with
0.1 dB ripple
The Chebyshev in both analog and digital forms still has a large
peak in the group delay, even with a small ripple (here 0.1 dB)
The Bessel filter has a much lower and smoother group delay,
but the magnitude response is rather sloppy
The filter passband is far from being flat and the roll-off is
gradual considering the filter order is seven
Note that
Z 1 Z 1
ˇ
x.t /e j 2f t dt ˇˇ
ˇ
x.t / dt D D X.0/
1 1 f D0
and Z 1 Z 1
jx.t /j dt x.t / dt
1 1
which implies
T x.0/ X.0/
Note that
Z 1 Z 1
ˇ
j 2f t
ˇ
X.f / df D X.f /e df ˇˇ D x.0/
1 1 t D0
and Z 1 Z 1
jX.f /j df X.f / df
1 1
which implies that
2W X.0/ x.0/
x(t) 1 |X(f)|/T 1
0.2 0.2
-1 -0.5 0.5 1
t/T -3 -2 -1 1 2 3 fT
f
-1/(2T) 1/(2T)
We see that for the case of the sinc. / function the bandwidth,
W , is clearly greater than the simple bound predicts
Risetime
There is also a relationship between the risetime of a pulse-like
signal and bandwidth
Definition: The risetime, TR , is the time required for the lead-
ing edge of a pulse to go from 10% to 90% of its final value
Given the impulse response h.t / for an LTI system, the step
response is just
Z 1
ys .t / D h./u.t / d
Z t1 Z t
if causal
D h./ d D h./ d
1 0
0.2 0.2
1 2 3 4 5 t RC -2 -1 1 2 3 t/B