Professional Documents
Culture Documents
Dspbasics PDF
Dspbasics PDF
Input Output
Signal Analog-to- Digital-to- Signal
Digital Computer Analog
Conversion Conversion
Fundamentals • What are we interested in, particularly when the signal is speech?
Processing
• What kind of processing do we need and encounter almost
everyday?
• Special effects?
1 2
3 4
1
Varying Sampling Rates
Speech Waveform Display
plot( );
Fs=8000 Hz
Fs=6000 Hz
stem( );
Fs=10000 Hz
7 8
sample 4
Sampled quantize
Sinusoid
2
5sin(2πnT)
0
y
6
6
-2
4
Analog Discrete
sinusoid, sinusoid
4
-4
2
5sin(2πx) -6
2 round[5sin(2πnT)]
0 5 10 15 20 25 30 35 40
0 n
y
0
y
-2 6
-2
Quantized
-4 4
sinusoid -4
-6 2 round[5sin(2πx)]
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -6
0 5 10 15 20 25 30 35 40
x
0
n
y
-2
quantize -4
sample SNR is a function of B, the number of bits in the quantizer
-6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
11 12
2
Issues with Discrete Signals The Sampling Theorem
Sampled 1000 Hz and 7000 Hz Cosine Waves; Fs = 8000 Hz
amplitude
telephone BW), 10 kHz (extended bandwidth), 16 kHz 0
(hi-fi speech) -0.5
• how many quantization levels are necessary at -1
each bit rate (bits/sample) 0 0.2 0.4 0.6 0.8 1 1.2
time in ms
– 16, 12, 8, … => ultimately determines the S/N ratio of
the speech • A bandlimited signal can be reconstructed exactly
from samples taken with sampling frequency
– speech coding is concerned with answering this
question in an optimal manner 1 2π
= Fs ≥ 2fmax or = ωs ≥ 2ωmax
T T
13 14
16
Noise: 10 12 bits
a1δ [n − 1]
a−3δ [n + 3]
a2δ [n − 2] a7δ [n − 7]
⎧1, n ≥ 0
unit step u[n] = ⎨ sine wave x[n] = A cos(ω 0 n + φ )
x[n ] = a−3δ [n + 3] + a1δ [n − 1] + a2δ [n − 2] + a7δ [n − 7] ⎩0, n < 0
17 18
3
Complex Signal
Variants on Discrete-Time Step Function x[n ] = (0.65 + 0.5 j )n u[n ]
u[n] u[n-n0]
u[n0-n]
21 22
4
LTI Discrete-Time Systems LTI Discrete-Time Systems
x[n] y[n] Example:
LTI
System Is system y [n ] = x[n ] + 2 x[n + 1] + 3 linear?
δ [n] h[n] x1[n ] ↔ y1[n ] = x1[n ] + 2 x1[n + 1] + 3
x2 [n ] ↔ y 2 [n ] = x2 [n ] + 2 x2 [n + 1] + 3
• Linearity (superposition): x1[n ] + x2 [n ] ↔ y 3 [n ] = x1[n ] + x2 [n ] + 2 x1[n + 1] + 2x2 [n + 1] + 3
Τ{ax1[n] + bx2 [n]} = aΤ{x1[n]} + bΤ {x2 [n]} ≠ y1[n ] + y 2 [n ] ⇒ Not a linear system!
Is system y [n] = x[n ] + 2 x[n + 1] + 3 time/shift invariant?
• Time-Invariance (shift-invariance):
y [n ] = x[n ] + 2x [n + 1] + 3
x1[n] = x[n − nd ] ⇒ y1[n] = y[n − nd ]
y [n − n0 ] = x [n − n0 ] + 2 x [n − n0 + 1] + 3 ⇒ System is time invariant!
• LTI implies discrete convolution: Is system y [n ] = x [n ] + 2 x [n + 1] + 3 causal?
∞ y [n ] depends on x[n + 1], a sample in the future
y[n] = ∑ x[k]h[n − k] = x[n]∗ h[n] = h[n]∗ x[n] ⇒ System is not causal! 26
k =−∞ 25
h[n] x[n]
Convolution Example
n n
⎧1 0≤n≤3 ⎧1 0≤n≤3 x[n],h[n] 01234 5 01234 5
x[n] = ⎨ h[n ] = ⎨ n=0 n=1 n=2
⎩0 otherwise ⎩0 otherwise
What is y [n ] for this system?
n
Solution : 01234 5 m m m
∞ 01234 5 01234 5 01234 5
y [n ] = x [n ] * h[n ] = ∑ h[m] x[n − m]
m =−∞
n=3 n=4 n=5
⎧ n
⎪ ∑ 1⋅ 1 = (n + 1) 0≤n≤3 y[n]
⎪ m =0 m m m
⎪ 3 01234 5 01234 5 01234 5
= ⎨ ∑ 1⋅ 1 = (7 − n ) 4≤n≤6 n=6 n=7 n=8
⎪ m = n −3
⎪0 n ≤ 0, n ≥ 7 01234 567
n
⎪
⎩
27 m m m
01234 56 01234 567 01234 5678
28
Convolution Example
Convolution Example
The impulse response of an LTI system is of the form:
h[n ] = a n u[n ] | a |< 1
and the input to the system is of the form:
x [ n ] = b n u [n ] | b |< 1, b ≠ a
Determine the output of the system using the formula
for discrete convolution.
SOLUTION:
∞
y [n ] = ∑a
m =−∞
m
u[ m ] b n − m u[ n − m ]
n n
= bn ∑a
m =0
m
b − m u [n ] = b n ∑ (a / b )
m =0
m
u [n ]
⎡1 − (a / b )n +1 ⎤ ⎡ b n +1 − a n +1 ⎤
= bn ⎢ ⎥=⎢ ⎥ u [n ]
⎣ 1 − (a / b ) ⎦ ⎣ b − a ⎦
29 30
5
Convolution Example Linear Time-Invariant Systems
Consider a digital system with input x [n ] = 1 for
n = 0,1,2,3 and 0 everywhere else, and with impulse • easiest to understand
• easiest to manipulate
response h[n ] = a u[n ], | a |< 1. Determine the
n
• powerful processing capabilities
response y [n ] of this linear system. • characterized completely by their response to unit sample,
h(n), via convolution relationship
SOLUTION: ∞ ∞
We recognize that x [n ] can be written as the difference between two y [n ] = x[n ] ∗ h[n ] = ∑ x[k ] h[n − k ] = ∑ h[k ] x[n − k ]
k =−∞ k =−∞
step functions, i.e., x [n ] = u[n ] − u[n − 4]. Hence we can solve for y [n ]
as the difference between the output of the linear system with a step input y [n ] = h[n ] ∗ x[n ], where ∗ denotes discrete convolution
x[n] y[n]=x[n]
and the output of the linear system with a delayed step input. Thus we solve
h[n] * h[n]
for the response to a unit step as:
∞
⎡ a n − a −1 ⎤ • basis for linear filtering
y 1[ n ] = ∑ u[m] a n −m
u [n − m ] = ⎢ −1 ⎥
u[n ]
m =−∞ ⎣ 1− a ⎦ • used as models for speech production (source convolved
y [n ] = y1[n ] − y1[n − 4] 31 with system) 32
h1[n]+h2[n]
x[n] y[n]
x[n] x[n-1] x[n]
h1[n]*h2[n]
y[n]
h2[n]
x[n] y[n]
h1[n]
h3[n]
h4[n]
D (Delay Element) ⇔ z −1
y [n ] = x [n ] * hc [n ] y [n ] = b0 x [n ] + b1x [n − 1] + ... + bM −1x [n − M + 1] + bM x [n − M ]
hc [n ] = h1[n ] * (h2 [n ] + h3 [n ]) + h4 [n ]
35 36
6
Network View of Filtering (IIR Filter)
z-Transform
x[n] y[n]
Representations
37 38
0.9
0.7
x[n ] ←⎯
→ X (z) with x[n] as coefficients of
0.6
plitude
0.5
am
−n
0.4
term in z
0.2
0.1
∞
0
0 1 2 3 4 5 6 7 8 9
sample number
X (z) = ∑ x[n]z
n =−∞
−n
• direct evaluation using residue theorem
| z |< ∞, n0 < 0; ∀z, n0 = 0
2. x[n ] = u[n ] − u[n − N ] -- box pulse
1
0.8
0.7
1 N-1
1 − z −N
0.6
∫ X(z) = ∑ (1)z − n =
• long division
amplitude
x[ n ] = X (z)z n −1dz -- converges for 0 <| z |< ∞
0.5
0.4
1 − z −1
0.3
2π j
0.2
C
0
0 1 2 3 4 5 6 7 8 9
sample number
∞ ∞
1
0.9
∑ | x[n] | | z −n X (z ) = ∑ a n z − n =
0.8
amplitude
0.5
n =0
0.4
n =−∞
0.3
0.1
0
0 5 10 15 20 25 30 35 40 45 50
sample number
40
-0.1
-0.2
-0.3
Example
-0.4
amplitude
-0.5
-0.6
-0.8
4. x[n ] = −b nu[ −n − 1]
-0.9
-1
-50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0
−1
1
X ( z ) = ∑ −b z = n −n
--converges for | z |<| b | the region of convergence for the sequence
n =−∞ 1 − bz −1
• all infinite duration sequences which are non-zero for n < 0 y [n ] = a n x [n ] in terms of X ( z )
7
z-Transform Property Inverse z-Transform
The sequence x [n ] has z-transform X ( z ).
Show that the sequence nx[n ] has z-transform 1
∫ X ( z )z
n −1
x[ n ] = dz
−z
dX ( z )
. 2π j C
dz
Solution:
where C is a closed contour that encircles the origin
∞ of the z-plane and lies inside the region of convergence
X (z) = ∑ x [ n ]z
n =−∞
−n
∞
dX ( z )
= − ∑ nx[n ]z − n −1
dz n =−∞ C for X(z) rational, can use
1 ∞ a partial fraction
= − ∑ nx[n ]z − n R1
R2
z n =−∞ expansion for finding
1 inverse transforms
= − Z (nx[n ])
z
43 44
Transform Properties
Linearity ax1[n]+bx2[n] aX1(z)+bX2(z)
Shift
Exponential Weighting
x[n-n0]
anx[n]
z − n0 X ( z)
X(a-1z)
Discrete-
Linear Weighting n x[n] -z dX(z)/dz Time Fourier
Time Reversal x[-n] X(z-1)
Transform
non-causal, need x[N0-n] to be
causal for finite length sequence
8
Discrete-Time Fourier Transform Simple DTFTs
∞ Impulse x[n ] = δ [n ], X (e j ω ) = 1
X (e jω ) = X (z ) |z =e jω = ∑ x[n]e
n =−∞
− jωn
Delayed
impulse
x[n ] = δ [n − n0 ], X (e jω ) = e − jωn0
z = e jω ; | z |= 1, arg(z ) = j ω Step function
x[n ] = u[n ], X (e j ω ) =
1
π 1 − e − jω
1
∫π X (e
jω
x[ n ] = )e jωn dω 1 − e − jωN
2π Rectangular
x[n ] = u[n ] − u[n − N ], X (e jω ) =
−
1 − e − jω
window
X (e jω ) =
1
| β |< 1
X (e ) = jω
∑ [πδ (ω − ω 0 + 2π k ) + πδ (ω + ω0 + 2π k )]
1 − β e − jω k =−∞
x[n ] = cos(ω0 n )
51 52
h[n ]
53 54
9
Fourier Transform Properties Periodic DT Signals
0.25, π/2, FS/ 4, π FS/ 2
Periodic Sequences??
Periodic DT Signals
Example 3:
Fs = 10, 000 Hz
Is the signal x[n] = cos(2π ⋅101n / Fs ) a periodic signal?
If so, what is the period.
Solution:
If the signal is periodic with period N , then we have:
x[ n] = x[ n + N ]
cos(2π ⋅101n / Fs ) = cos(2π ⋅101(n + N ) / Fs )
2π ⋅101N
= 2π ⋅ k ( k an integer )
Fs
101N 101N
k= = which is not an integer
Fs 10, 000
Thus x[ n] is not periodic at this sampling rate.
59 60
10
Discrete Fourier Transform
• consider a periodic signal with period N (samples)
x%[n ] = x%[n + N ], − ∞ < n < ∞
x%[n ] can be represented exactly by a discrete
The DFT – Discrete sum of sinusoids
N −1
X% [k ] = ∑ x%[n ]e − j 2π kn / N
Fourier Transform n =0
• N sequence values
N −1
1
x%[n ] = ∑ X% [k ]e j 2π kn / N
N k =0
• N DFT coefficients
61
• exact representation of the discrete periodic sequence 62
DFT Examples
DFT Examples x%[n ] = (0.9)n 0 ≤ n ≤ 31 (N = 32)
x[n] X [k]
65 66
11
Circularly Shifting Sequences Review
DTFT of sequence { x[n ], − ∞ < n < ∞}
x[n-2] x((n-2)) ∞
x[n] X (e jω ) = ∑ x [n ] e
n =−∞
− j ωn
1 π
2π ∫−π
x[n ] = X (e jω ) e jωn
x[n-1] x[-n] x((-n))
x((n-1)) DFT of periodic sequence { x% [n], 0 ≤ n ≤ N − 1}
N −1
X% [k ] = ∑ x% [n ] e − j 2π nk / N , 0 ≤ k ≤ N − 1
n =0
1 N −1
x% [n ] = ∑ X% [k ] e j 2π nk / N , 0 ≤ n ≤ N − 1
N k =0
67 68
j 2π k / N N −1
X [k ]=X (e ∑ x[n ]e− j 2π kn /N , k =0,1,...,N −1
)=
n =0
69 70
--looks like DFT of periodic sequence!
0.9
0.7
~
0.6
∞
amplitude
~
0.5
∑ x [n + r N ]
x[n]
x% (n ) = X[k]
0.4
0.3
0.2
0
0 2 4 6 8 10 12 14 16 18
s ample number
spectrum in frequency
- the Fourier coefficients, X% [k ], are then identical to the values
n k
j 2π k /N
of X (e ) for the finite duration sequence => a sequence
of length N can be exactly represented by a DFT representation
x[n] X(ejω)
of the form:
finite duration =>
N −1
− j 2π nk / N continuous spectrum
X [k ] = ∑ x[n ]e , k = 0,1,..., N − 1 Works for both n ω in frequency
n=0 finite sequence
and for periodic
1 N −1 j 2π kn / N , n = 0,1,..., N − 1 sequence
x[ n ] = ∑ X [k ]e
Nk =0
71 72
12
Sampling in Frequency (Time Domain Aliasing) Sampling in Frequency (Time Domain Aliasing)
Consider a finite duration sequence: jω
S(e )
x[n ] ≠ 0 for 0 ≤ n ≤ L − 1
i.e., an L − point sequence, with discrete time Fourier transform . . .
L −1
If the duration of the finite duration signal satisfies the relation
X (e jω ) = ∑ x[n ] e − jωn 0 ≤ ω ≤ 2π
n =0 0 1 2 3 4 N-1 k N ≥ L, then only the first term in the infinite summation affects
ω=2πk/N
Consider sampling the discrete time Fourier transform by
s[n]
the interval 0 ≤ n ≤ L − 1 and there is no time domain aliasing, i.e.,
multiplying it by a signal that is defined as:
N −1
x%[n ] = x[n ] 0 ≤ n ≤ L − 1
S (e ) = ∑ δ [ω − 2π k / N ]
jω
. . . . . .
k =0
If N < L, i.e., the number of frequency samples is smaller than the
with time-domain representation
-N 0 N 2N n
duration of the finite duration signal, then there is time domain aliasing
∞
s[n ] = ∑ δ [n − rN ]
r =−∞
and the resulting aliased signal (over the interval 0 ≤ n ≤ L − 1) satisfies
Thus we form the spectral sequence the aliasing relation:
X% (e jω ) = X (e jω ) ⋅S (e jω ) x%[n ] = x[n ] + x[n + N ] + x[n − N ] 0 ≤ n ≤ N − 1
which transforms in the time domain to the convolution
∞ ∞
x% [n ] = x[n ]∗ s[n ] = x[n ] ∗ ∑ δ [n − rN ] = ∑ x[n − rN ]
r =−∞ r =−∞
The discrete time Fourier transform of x[n] is computed and sampled at N frequencies • when using DFT representation, all sequences behave as if they
around the unit circle. The resulting sampled Fourier transform is inverse were infinitely periodic => DFT is really the representation of the
transformed back to the time domain. What is the resulting time domain signal, x%[n], ∞
(over the interval 0 ≤ n ≤ L − 1) for the cases N = 11, N = 5 and N = 4. extended periodic function, x%[n ] = ∑ x[n + rN ]
r =−∞
x%[0] = 6 (as opposed to 1 for x[0]) with the remaining values unchanged. x%[n ] = ∑ x[n + rN ] = x[n modulo N ] = x ([n])
r =−∞
N
75 76
13
Key Transform Properties Sampling Function
y [n ] = x1[n ] ∗ x2 [n ] ⇔ Y (e jω ) = X1(e jω ) ⋅ X 2 (e jω )
convolution multiplication x[n]
... ...
jω jω jω
y [n ] = x1[n ] ⋅ x2 [n ] ⇔ Y (e ) = X1(e ) ⊗ X 2 (e )
multiplication circular convolution 0 M 2M n
Summary of DSP-Part 1
• speech signals are inherently bandlimited => must
sample appropriately in time and amplitude
• LTI systems of most interest in speech processing; can
characterize them completely by impulse response, h(n)
• the z-transform and Fourier transform representations
enable us to efficiently process signals in both the time Digital Filters
and frequency domains
• both periodic and time-limited digital signals can be
represented in terms of their Discrete Fourier transforms
• sampling in time leads to aliasing in frequency; sampling
in frequency leads to aliasing in time => when
processing time-limited signals, must be careful to
sample in frequency at a sufficiently high rate to avoid
time-aliasing
81 82
∑ | h[n] |< ∞
jω
H (e jω ) =| H (e jω ) | e j arg|H ( e )| magnitude, phase representation
14
Digital Filter Implementation Digital Filters
• input and output satisfy linear difference equation of the
form:
N M −1
y [n ] − ∑ ak y [n − k ] = ∑ br x[n − r ] • H(z) is a rational function in z
k =1 r =0 O
• evaluating z-transforms of both sides gives: M
A∏ (1 − cr z ) −1
N M X
H (z) = => M zeros, N poles O
Y (z) − ∑ ak z − kY (z ) = ∑ br z − r X (z)
r =1
N
X
k =1 r =0
∏ (1 − dk z −1 ) O
X
N M k =1 X
Y (z) (1 − ∑ ak z − k ) = X (z)∑ br z − r
k =1 r =0
• converges for | z |> R1 , with R1 < 1 for stability O
M
Y (z ) ∑b z r
−r canonic form
showing poles
=>
H (z) = = r =0
all poles of H (z ) inside the unit circle for a
X (z) N and zeros
1 − ∑ ak z − k stable, causal system
k =1 85 86
M
y [n ] = ∑ br x[n − r ] = b0 x[n ] + b1 x[n − 1] + ... + bM x[n − M ] =>
r =0
1. h[n ] = bn 0 ≤ n ≤ M
=0 otherwise
M M −1
2. H (z ) = ∑ bn z − n => ∏ (1 − c m z −1 ) => M zeros
n =0 m =0
• linear phase filter => no signal dispersion because of non-linear phase =>
precise time alignment of events in signal
15
LPF Example Using RW LPF Example Using RW
6. Kaiser w [n ] =
{
I0 β 1 − ((n − M / 2) / (M / 2)) 2 }
0 0.25 π 0.5 π 0.75 π π I0 {β }
93 94
Frequency
16
Equiripple Design Specifications Optimal FIR Filter Design
• Equiripple in each defined band (passband
and stopband for lowpass filter, high and
low stopband and passband for bandpass
filter, etc.)
• Optimal in sense π
that the cost function
1
2π ∫π
E= β (ω ) | H (ω) − H (ω) | dω
d
2
−
ωp = normalized edge of passband frequency is minimized. Solution via well known
ωs = normalized edge of stopband frequency
δ p = peak ripple in passband
iterative algorithm based on the alternation
δ s = peak ripple in stopband theorem of Chebyshev approximation.
Δω =ωs − ωp = normalized transition bandwidth 97 98
figure,orient landscape;
stitle=sprintf('bandpass fir design,
N:%d,f: %4.2f %4.2f %4.2f %4.2f %4.2f
%4.2f',N,F);
y[n]
n=0:N;
subplot(211),plot(n,B,'r','LineWidth',2);
axis tight,grid on,title(stitle);
xlabel('Time in Samples'),ylabel('Amplitude');
legend('Impulse Response');
• linear phase filters can be implemented with half
subplot(212),plot(W/pi,20*log10(abs(H)),'b','LineWidth',2);
the multiplications (because of the symmetry of
axis ([0 1 -60 0]), grid on; the coefficients)
xlabel('Normalized Frequency'),ylabel('Log Magnitude (dB)');
legend('Frequency Response'); 101 102
17
IIR Systems IIR Design Methods
N M
y [n ] = ∑ ak y [n − k ] + ∑ br x[n − r ] • Impulse invariant transformation – match the
k =1 r =0
105 106
0 0.2 π 0.4 π 0.6 π 0.8 π π
Frequency
18
Chebyshev Type II Design Elliptic BPF Design
0 0.2 π 0.4 π 0.6 π 0.8 π π 109 0 0.2 π 0.4 π 0.6 π 0.8 π π 110
Frequency Frequency
M=N=4
N M
y [n ] = ∑ ak y [n − k ] + ∑ br x[n − r ]
k =1 r =0
N
w [n ] = ∑ ak w [n − k ] + x[n ]
k =1
M
y [n ] = ∑ br w [n − r ]
r =0
[b,a]=ellip(6,0.1,40,0.45); [h,w]=freqz(b,a,512); x=[1,zeros(1,511)]; y=filter(b,a,x); zplane(b,a);
appropriate plotting commands; 113 114
19
IIR Filter Implementations IIR Filter Implementations
N K
c0 k + c1k z −1
A∏ (1 − cr z −1 )
H (z) = ∑ −1
, parallel system
H (z) = - zeros at z = cr , poles at z = d k
k =1 1 − a1k z − a2 k z −2
r =1
N
∏ (1 − d z
k =1
k
−1
)
c01
- since ak and br are real, poles and zeros occur in complex conjugate pairs =>
−1 −2
b0k + b1k z + b2 k z
K
⎡ N + 1⎤
H(z) = A∏ , K =⎢
1 − a1k z −1 − a2k z −2
k =1 ⎣ 2 ⎥⎦ Common form
- cascade of second order systems for speech
a21
synthesizer
Used in formant c02 implementation
synthesis
systems based
a12
on ABS c12
methods
115 116
20
Sampling Theorem Interpretation Sampling Rates
• FN = Nyquist frequency (highest frequency with
significant spectral level in signal)
• must sample at at least twice the Nyquist
To avoid aliasing need: frequency to prevent aliasing (frequency
2π / T − ΩN > ΩN
overlap)
– telephone speech (300-3200 Hz) => FS=6400 Hz
⇒ 2π / T > 2 ΩN
– wideband speech (100-7200 Hz) => FS=14400 Hz
⇒ Fs = 1/ T > 2FN
– audio signal (50-21000 Hz) => FS=42000 Hz
– AM broadcast (100-7500 Hz) => FS=15000 Hz
case where 1 / T < 2FN ,
• can always sample at rates higher than twice the
aliasing occurs Nyquist frequency (but that is wasteful of
processing)
121 122
bandlimited sample
x[n ] = xa (nT ), X a ( j Ω) = 0 for | Ω |> 2π FN
∞
⎡ sin(π (t − nT ) / T ) ⎤
∑ xa (nT ) ⎢ π (t − nT ) / T ⎥ if 1/ T > 2FN (adequate sampling) then
interpolation—perfect at
x a (t ) = every sample point,
n =−∞ ⎣ ⎦ perfect in-between
samples via interpolation
1 π
• digital-to-analog converter X(e j ΩT ) = X a ( j Ω), | Ω |<
T T
123 124
125 126
21
Decimation Decimation
want to reduce sampling rate of
sampled signal by factor of M ≥ 2
want to compute new signal xd [n]
with sampling rate Fs ' = 1/ T ' = 1( MT ) = Fs / M
such that xd [n] = xa (nT '' ) with no aliasing need
one solution is to downsample x[n] = xa (nT ) Fs ' ≥ 2 FN
to avoid aliasing for M = 2 (c )
by retaining one out of every M samples of x[n],
when
giving xd [n] = x[nM ] Fs ' < 2 FN
we get aliasing for M = 2 (d )
127 128
Decimation Decimation
to decimate by factor of M with no aliasing, need to
ensure that the highest frequency in x[n] is no greater
DTFTs of x[n] and xd [n] related by aliasing relationship: than Fs / (2M )
1 M −1 thus we need to filter x[n] using an ideal lowpass
X d (e jω ) = ∑ X (e j (ω −2π k )/ M )
M k =0 filter with response:
or equivalently (in terms of analog frequency): ⎧1 | ω |< π / M
H d (e jω ) = ⎨
⎩0 π / M <| ω |≤ π
M −1
1
X d (e j ΩT '
)=
M
∑ X (e
k =0
j ( ΩT ' − 2π k )/ M
)
using the appropriate lowpass filter, we can down-
1 sample the reuslting lowpass-filtered signal
assuming Fs ' = ≥ 2 FN , (i.e., no aliasing) we get:
MT by a factor of M without aliasing
j ΩT ' 1 jΩT '/ M 1 1 1
X d (e ) = X (e )= X (e jΩT ) = X a ( jΩ)
M M MT
1 π π
= X a ( jΩ), − < Ω < 129 130
T' T' T'
Decimation Interpolation
using a lowpass filter gives: assume we have x[n] = xa ( nT ), (no aliasing) and we wish to increase
1 π π the sampling rate by the integer factor of L
Wd (e jΩT ' ) = H d (e jΩT ) X a ( jΩ), − < Ω < we need to compute a new sequence of samples of xa (t ) with period
T' T' T'
T '' = T / L, i.e.,
if filter is used, the down-sampled signal, wd [ n],
xi [ n] = xa (nT '') = xa ( nT / L)
no longer represents the original analog signal, It is clear that we can create the signal
xa (t ), but instead the lowpass filtered version of xi [ n] = x[ n / L] for n = 0, ± L, ±2 L,...
but we need to fill in the unknown samples by an interpolation process
xa (t ) can readily show that what we want is:
the combined operations of lowpass filtering ∞
⎡ sin[π (nT ''− kT ) / T ] ⎤
xi [ n] = xa (nT '') = ∑ x (kT ) ⎢ ⎥
⎣ [π ( nT ''− kT ) / T ] ⎦
a
and downsampling are called decimation. k =−∞
22
Interpolation
implementing the previous equation by filtering the upsampled sequence
Interpolation
⎧ x [n / L] n = 0, ± L, ±2 L,...
xu [ n] = ⎨
⎩ 0 otherwise (a ) Plot of X ( e jΩT )
xu [ n] has the correct samples for n = 0, ± L, ±2 L,..., but it has zero-valued (b) Plot of X u (e jΩT '' ) showing double
samples in between (from the upsampling operation) periodicity for L = 2, T '' = T / 2
(c ) DTFT of desired signal with
The Fourier transform of xu [n] is simply:
⎧(2 / T ) X a ( jΩ) | Ω |≤ 2π FN
X u (e jω ) = X (e jω L ) X i ( e jΩT '' ) = ⎨
⎩ 0 2π FN <| Ω |≤ π / T ''
j ΩT '' j ΩT '' L j ΩT
X u (e ) = X (e ) = X (e ) can obtain results of ( c) by applying ideal
Thus X u (e jΩT '' ) is periodic with two periods, namely lowpass filter with gain L (to restore amplitude)
and cutoff frequency 2π FN = π / T , giving:
with period 2π / L, due to upsampling) and 2π due to being a digital signal
⎧(1 / T '') X (e jω L ) 0 ≤| ω |< π / L
X i ( e jω ) = ⎨
⎩ 0 π / L ≤| ω |≤ π
⎧L | ω |< π / L
H i ( e jω ) = ⎨
⎩ 0 π / L ≤| ω |≤ π
133 134
• can approximate almost any rate conversion with appropriate values of L and M
• for large values of L, or M, or both, can implement in stages, i.e., L=1024, use
L1=32 followed by L2=32
135 136
Summary of DSP-Part II
• digital filtering provides a convenient way of processing
signals in the time and frequency domains
• can approximate arbitrary spectral characteristics via
either IIR or FIR filters, with various levels of
approximation
• can realize digital filters with a variety of structures,
including direct forms, serial and parallel forms
• once a digital signal has been obtain via appropriate
sampling methods, its sampling rate can be changed
digitally (either up or down) via appropriate filtering and
decimation or interpolation
137
23