SlideShare a Scribd company logo
2
Most read
3
Most read
19
Most read
Department of Digital Signal
Processing
Master of Science in Electronics
Multirate Systems
Homework 1
Decimation and interpolation
Dr. Gordana Jovanovic Dolecek
Ojeda Loredo Fernando
June/15/2015
Sta. Ma. Tonantzintla, Puebla
Introduction
The decimator is a device that reduces the sampling rate by an integer factor of M,
whereas the interpolator is used to increase the rate by L.
In many applications the sampling rate of a system needs to be changed for a lower or
higher sampling rate for an appropriate processing of the signal, for example in a digital
mobile receiver system, the received signal often presents a high frequency which cannot be
digitized by the ADC converter , so it needs to be first converted to a lower frequency using
an Rf analog downconversion, the resultant frequency is commonly known as intermedia-
te frequency, after ADC a FIR filter is used to select a desired bandwidth and then it is
downsampled or upsampled to an appropriate sampling rate. In digital audio applications a
number of sampling rates coexist, for example, the sampling rate for studio work is 48KHz,
whereas for cd production is 44.1KHz, and the broadcast rate is 32KHz.All this rate con-
versions can be made using decimators and interpolators devices, systems that use different
sampling rates are known as multirate systems.[3]
Downsampling
The process of downsampling consist in reducing the sampling rate of a signal that
is already sampled, by an integer factor M, basically we are resampling the signal, but
because we are reducing the sampling rate then we call this as subsampling. When a signal
is downsampled we reduce the amount of data by taking only every M-th sample of the
signal and discarding all others as we can see in fig 2.
Figure 1: Downsampling.
Figure 2: Downsampling in time.
1
The downsamplig process can be described in time and frequency in two steps:
step 1. we obtain a signal x (n) from x(n) by setting all samples whose indexes are not
integer multiples of M to zero. We can consider x (n) as a multiplication of x(n) and CM (n)
where M denotes the downsamplig factor, in this case we use M = 2 to explain the process.
x (n) = x(n)CM (n) (1)
We express this signal in matlab as follows:
N = 26;
n = 0:N-1;
x = 0.8*sin(2*pi*0.0625*n)+0.3*sin(2*pi*0.2*n);
cm = [zeros(1,26)];
for k = 1:2:26
cm(k) = 1;
end
x2 = x.*cm;
We can see the result of first step in the figure 3 where only every 2n samples of x(n) are
taken and the others are set to zero.
Figure 3: Step 1, time.
This operation does not change the content of the signal x’(n), the spectrum undergoes
a replica every 2π/M as we can see in fig. 4, as M = 2 then the spectrum replicas appears
every π, where π = 1 in normalized frequency. Because we removed samples in time, in
frequency the spectrum is scaled by a factor of 2, we can see this scaling in fig. 4.b. Later in
this document we will present the effects of aliasing due to the overlapping of the frequency
bands and how we can avoid this undesired effect that distorts the signal.
2
Figure 4: Step 1, frequency.
step 2. The next step is to remove the zeros in x (n) and thus obtain y(m):
y = downsample(x,2);
This operation introduce time scaling by a factor of 1/M. Due to te principle of duality
in time-frequency, in time we get a compression so we expect an expansion in frequency as
we can see in fig 6. The frequency is scaled by a factor of 2.
Figure 5: Step 2, scaling in time. Figure 6: Scaling in frequency.
3
Aliasing
When a signal is downsampled, the replicas generated by the first step can overlap, this
occurs if the original signal is not bandlimited to π/M. This overlapping effect is called
aliasing, to avoid this we use a low-pass digital filter that should precede the down-sampler,
in fig 7 we can see this effect.
Figure 7: Aliasing with M = 4.
Properties of downsampling
A system is said to be linear if it complies whit the principle of superposition
T{αx1(n) + βx2(n)} = αTx1(n) + βTx2(n) (2)
We demonstrate this principle using MATLAB as follows:
N = 16;
n = 0:N−1;
a = 2;
b = 3;
x1 = 0.8∗ sin (2∗ pi ∗0.0625∗n ) ;
x2 = 0.3∗ sin (2∗ pi ∗0.2∗n ) ;
xs = a .∗ x1 + b .∗ x2 ;
xsd = downsample ( xs , 2 ) ; % Structure 1
xd1 = downsample (x1 , 2 ) ;
xd2 = downsample (x2 , 2 ) ;
x12d = a .∗ xd1 + b .∗ xd2 ; % Structure 2
4
We observe in fig. 8 that xsd and x12 are equal, thus we prove the linearity of the down-
sampling process.
Figure 8: linear property.
We can also demonstrate this principle using Simulink.
Figure 9: Structure 1. Figure 10: Structure 2.
If an input signal undergoes a transformation through a system we get a transformed
output signal, also if the same input signal is shifted in time k samples then we expect the
same transformed output signal but shifted k samples in time, if this is accomplished then
we say that the system is time invariant. we will demonstrate the time variance or time
invariance of a downsampling process as follows:
N = 32;
n = 0:N-1;
k = 4;
x = 0.8*sin(2*pi*0.0625*n);
xs = 0.8*sin(2*pi*0.0625*(n - k));
xd = downsample(x,2);
xsd = downsample(xs,2);
5
We observe in fig. 12 that the downsampled shifted signal xsd does not present the same
shift as the input signal xs, thus we conclude downsampling is a time varying operation.
Figure 11: Delayed signal by 4 samples. Figure 12: Downsampled delayed signal.
When the relation K/M is not an integer the downsampled delayed signal will have
a fractional delay, this means that the downsampled signal with no input delay and the
downsampled delayed signal will have a different shape as we can see in fig 13.
Figure 13: Downsampled signals with fractional delay.
6
Downsampling identities
First identity
This identity follows directly from the principle of superposition, as previously discussed.
Second identity
Establishes that the delay of M samples before the downsampler is equivalent to a delay
of one sample after the downsampler. We will show this second identity using Simulink, as
follows:
Figure 14: Structure 1. Figure 15: Structure 2.
Comparing the two graphics in fig. 16 and fig 17 it follows that structure 1 and structure
2 are equivalent.
Figure 16: Structure 1 plot. Figure 17: Structure 2 plot.
7
Third identity
This identity is related to cascade connection of a linear time invariant system H(Z) and
a downsampler. Filtering with H(ZM
) and downsampling by M is equal to the downsampling
by M and filtering with H(Z).
Figure 18: Third identity structures.
The third identity is demonstrated using a filter expanded with M = 4 which precedes
the downsampler as can be seen in structure 1 in figure 18. Another filter is designed to
implement structure 2, and finally the graphs in figure 19, show this identity, the Matlab
implementation is as follows:
n = 0 : 6 0 ; % Time index
x = cos (2∗ pi ∗0.05∗n ) ; % Generating the o r i g i n a l s i g n a l
h = f i r 1 ( 1 0 , 0 . 5 ) ; % Designing the f i l t e r t r a n s f e r function H( z )
hu = upsample (h , 4 ) ; % Transfer function H( zˆM)
y1 = f i l t e r (hu ,1 , x ) ; % F i l t e r i n g
y = downsample (y1 , 4 ) ; % Down−sampling
m = 0: length (y)−1; % Time index
f i g u r e (1)
subplot (3 ,2 ,1) , stem (n , x ) , ylabel ( ’ x [ n ] ’ )
t i t l e ( ’ Figure 18(a ) ’)
subplot (3 ,2 ,3) , stem (n , y1 ) , ylabel ( ’ y 1 [ n ] ’ )
subplot (3 ,2 ,5) , stem (m, y ) , ylabel ( ’ y [m] ’ )
xlabel ( ’ Time index ’ )
y2 = downsample (x , 4 ) ; % down−sampling
y = f i l t e r (h ,1 , y2 ) ; % f i l t e r i n g
subplot (3 ,2 ,2) , stem (n , x , ’ r ’ ) , ylabel ( ’ x [ n ] ’ )
t i t l e ( ’ Figure 18(b ) ’)
subplot (3 ,2 ,4) , stem (m, y2 , ’ r ’ ) , ylabel ( ’ y 2 [m] ’ )
subplot (3 ,2 ,6) , stem (m, y , ’ r ’ ) , ylabel ( ’ y [m] ’ )
xlabel ( ’ Time index ’ )
In figure 19 the left-hand side shows the signals for structure 1, and the right-hand side
presents the signals for structure 2. This results shown in fig. 19 demonstrate the equivalence
of the cascade connections defined by the third identity.
8
Figure 19: Illustration of the third identity.
Polyphase decimation
The decimation structure consists of two block as can be seen in figure 20, a low-pass
filter which discard all frequencies above π/M to avoid aliasing, and the downsamplign block
which reduce the sampling rate of the signal.
Figure 20: Decimation structure.
Usually H(z) is a FIR filter, which consist of N coefficients. If N is a integer multiple of
M we can obtain M different discretely sampled components of the impulse response. That
means that the corresponding Z-transform ca be partitioned into M sub-signals
H(z) =
M−1
k=0
z−k
Hk(zM
) (3)
where
Hk(zM
) =
N/M−1
n=0
h(nM + k)(zM
)−n
) (4)
9
The filter shown in the structure from figure 20, can be decomposed as we can observe in
figure 21.a this is a direct application of the first identity, now in figure 21.b we can see an
application of the third identity. With this implementation we obtain a more efficient version
in which both the number of filter operations as well the amount of memory required are
reduced by a factor of M.
Figure 21: Polyphase decimation.
Now we present an example in Matlab with a FIR filter which consist of N = 64 coeffi-
cients, an a decimation factor of M = 4, so we expect 4 polyphase components.
% Polyphase decomposition
c l e a r all , c l o s e a l l
% Input s i g n a l
n = 0 : 6 3 ;
h = zeros ( s i z e (n ) ) ; h (11:39) = 0 . 9 5 . ˆ ( 1 : 2 9 ) ; % Generating the sequence ’h ’
% Polyphase down−sampling with the phase of f s e t
10
h0 = downsample (h , 4 ) ;
h1 = downsample (h , 4 , 1 ) ;
h2 = downsample (h , 4 , 2 ) ;
h3 = downsample (h , 4 , 3 ) ;
subplot (4 ,1 ,1) , stem ( 0 : length ( h0)−1,h0 ) , ylabel ( ’ h0 [m] ’ )
subplot (4 ,1 ,2) , stem ( 0 : length ( h1)−1,h1 ) , ylabel ( ’ h1 [m] ’ )
subplot (4 ,1 ,3) , stem ( 0 : length ( h2)−1,h2 ) , ylabel ( ’ h2 [m] ’ )
subplot (4 ,1 ,4) , stem ( 0 : length ( h3)−1,h3 ) , ylabel ( ’ h3 [m] ’ )
xlabel ( ’ Time index m’ )
The original signal is shown in figure 22 and the polyphase components are given in 23.
Figure 22: Filter Coefficients. Figure 23: Polyphase components.
Upsampling
Upsampling increases the sampling rate by an integer factor L, by inserting L-1 equally
spaced zeros between each pair of samples.
y[m] =
x[m/L], m = 0, ±L, ±2L, ...
0, Otherwise
(5)
Where L is called an interpolator factor. The symbol for this operation is a box with an
upward-pointing arrow, followed by the interpolator factor.[2]
Figure 24: Upsampler.
11
The following Matlab code illustrates an example of the upsampler with L = 2.
N = 21; % Length of the o r i g i n a l sequence
n=0:N−1; % Time index
x=0.7∗ sin (2∗ pi ∗0.0625∗n)+0.3∗ sin (2∗ pi ∗0.2∗n ) ; % Original s i g n a l
L= 2; % Up−sampling factor
y=zeros (1 ,L∗ length (x ) ) ;
y ( [ 1 : L: length (y)])= x ; % Up−sampled s i g n a l
Ny = length (y)−L+1; % Length of the up−sampled s i g n a l
f i g u r e (2)
subplot (2 ,1 ,1)
stem (0:20 , x ( 1 : 2 1 ) )
xlabel ( ’ Time index n ’ ) , ylabel ( ’ x [ n ] ’ )
subplot (2 ,1 ,2)
stem (0:40 , y ( 1 : 4 1 ) )
xlabel ( ’ Time index m’ ) , ylabel ( ’ y [m] ’ )
We can see in figure 25, how the sampling rate is increased also we can see how L-1
equally space zeros are inserted between each pair of samples.
Figure 25: upsampling by L = 2.
12
Imaging
The interpolator consist of two stages as we can see in figure 26, the upsampler block
that was previously discussed and a low pass filter that is after the upsampler.
Figure 26: Interpolator
The process of upsampling introduces the replicas of the main spectra at every 2π/L.
This is called imaging, since there are L-1 replicas (images) in 2π. We illustrate this effect
next:
F = [ 0 , 0 . 2 , 0 . 9 , 1 ] ;
A = [ 0 , 1 , 0 , 0 ] ;
x = f i r 2 (128 ,F,A) ;
X = f f t (x , 1 0 2 4 ) ;
f = 0:1/1024:(512 −1)/1024;
y1 = upsample (x , 2 ) ;
y2 = upsample (x , 3 ) ;
y3 = upsample (x , 4 ) ;
Y1 = f f t (y1 , 1 0 2 4 ) ;
Y2 = f f t (y2 , 1 0 2 4 ) ;
Y3 = f f t (y3 , 1 0 2 4 ) ;
subplot (4 ,1 ,1) , plot (2∗ f , abs (X( 1 : 5 1 2 ) ) ) , t i t l e ( ’ o r i g i n a l signal ’ )
subplot (4 ,1 ,2) , plot ( f ∗2 , abs (Y1( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 2 ’)
subplot (4 ,1 ,3) , plot (2∗ f , abs (Y2( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 3 ’)
subplot (4 ,1 ,4) , plot ( f ∗2 , abs (Y3( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 4 ’)
In figure 27 we can observe the different replicas for L = 2,3,4. We use the low pass filter
to remove these replicas, this filter is called an anti-imaging filter. In Matlab we can show
the use of this filter by using the command interp, like the command decimate, this already
includes the filter unlike the commands downsample and upsample which do not include it.
13
Figure 27: Interpolator
Next code show the use of interp, to remove the replicas for L = 4.
F = [ 0 , 0 . 2 , 0 . 9 , 1 ] ;
A = [ 0 , 1 , 0 , 0 ] ;
x = f i r 2 (128 ,F,A) ;
X = f f t (x , 1 0 2 4 ) ;
f = 0:1/1024:(512 −1)/1024;
L = 4;
xu = upsample (x ,L ) ;
y = interp (x ,L ) ;
Xu = f f t (xu , 1 0 2 4 ) ;
Y = f f t (y , 1 0 2 4 ) ;
subplot (3 ,1 ,1) , plot (2∗ f , abs (X( 1 : 5 1 2 ) ) ) , t i t l e ( ’ o r i g i n a l signal ’ )
subplot (3 ,1 ,2) , plot ( f ∗2 , abs (Xu( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 4 ’)
subplot (3 ,1 ,3) , plot (2∗ f , abs (Y( 1 : 5 1 2 ) ) ) , t i t l e ( ’ interpolated signal ’ )
f i g u r e
subplot (3 ,1 ,1) , stem (54:74 , x ( 5 5 : 7 5 ) ) ;
subplot (3 ,1 ,2) , stem(4∗55−1:4∗74−1,xu(4∗55 −1:4∗74 −1));
subplot (3 ,1 ,3) , stem(4∗55−1:4∗74−1,y(4∗55 −1:4∗74 −1));
14
In the following figure we observe the effect of imaging also is necessary to say that the
upsampling process consist of the increase in the sampling rate of the signal, this is known
as an expansion in time, by the principle of duality, in the frequency domain we expect a
compression as shown in figure 28.
Figure 28: Imaging and interpolation in frequency
In time something very interesting happens due to the filter, the zeros that are inserted
by the upsampler are interpolated, for this reason we call this filter an interpolation filter, we
can see it in figure 29, also the frequency spectrum is scaled by a factor of L this is presented
in figure 28.c.
Figure 29: Interpolation in time
15
Properties of upsampling
Now we show the linearity of the upsample operation, just like in downsampling we will
use the same code but now we use the command upsample instead of downsample as shown
next.
N = 16;
n = 0:N−1;
a = 2;
b = 3;
x1 = 0.8∗ sin (2∗ pi ∗0.0625∗n ) ;
x2 = 0.3∗ sin (2∗ pi ∗0.2∗n ) ;
xs = a .∗ x1 + b .∗ x2 ;
xsd = upsample ( xs , 2 ) ; % Structure 1
xd1 = upsample (x1 , 2 ) ;
xd2 = upsample (x2 , 2 ) ;
x12d = a .∗ xd1 + b .∗ xd2 ; % Structure 2
We observe in figure 30 that xsd and xsd12 are equal so we can conclude that upsampling
is a linear operation.
Figure 30: Upsampling linear property
16
We also demonstrate this property using Simulink as follows:
Figure 31: Structure 1 Figure 32: Structure 2
Now we will show the time varying property of the upsampling block. We suppose that
the input of the upsampler has a delay of D samples.
x(m − D) (6)
The upsampled signal will be:
y((m − D)L) = y(mL − DL) = y(n − DL) = y(n − D) (7)
Consequently, upsampling is a time-dependent operation.
N = 32;
n = 0:N−1;
k = 9;
x = 0.8∗ sin (2∗ pi ∗0.0625∗n ) ;
xs = 0.8∗ sin (2∗ pi ∗0.0625∗(n − k ) ) ;
xu = upsample (x , 2 ) ;
xsu = upsample ( xs , 2 ) ;
f i g u r e
subplot (2 ,1 ,1) , stem (x , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ x ’ ) , grid ;
subplot (2 ,1 ,2) , stem ( xs , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ xs ’ ) , grid ;
f i g u r e
subplot (2 ,1 ,1) , stem (xd , ’ r ’ , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ xu ’ ) , grid ;
subplot (2 ,1 ,2) , stem ( xsd , ’ r ’ , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ xsu ’ ) , grid ;
In figure 33 xs represent a shifted version of x by 9 samples, in figure 34 xu is the
upsampled signal by L = 2 of x and xsu is the upsampled signal of xs. We expect the same
amount of delay in xsu and xs, but xsu is shifted by 14 samples unlike xs which is shifted
by 9 samples, thus we prove that upsampling is a time-varying operation.
17
It is important to mention that unlike downsampling, the upsampled delayed signal and
the upsampled signal with no delay will always have the same shape, this is because the
delay DL is always an integer.
Figure 33: Delayed signal by 9 samples Figure 34: Upsampled delayed signal
Upsampling identities
We have already seen three useful identities of the downsampled signals, and now we will
state the corresponding identities associated with upsampling.
Fourth identity
We have already demonstrated the fourth identity as it follows from the principle of
superposition.
Fifth identity
This identity states that a delay of one sample before upsampling is equivalent to the
delay of L samples after upsampling.
Figure 35: Structure 1 Figure 36: Structure 2
18
Figure 37 and 38 are equal, so the equivalence of the two structures is confirmed.
Figure 37: Structure 1 plot Figure 38: Structure 2 plot
Sixth identity
States that the filtering followed by upsampling is equivalent to having upsampling first
followed by expanded filtering.
Figure 39: Sixth identity structures
n = 0 : 1 5 ; % Time index
x = cos (0.2∗ pi ∗n ) ; % Generating the o r i g i n a l s i g n a l
h = f i r 1 ( 1 0 , 0 . 5 ) ; % Designing the f i l t e r t r a n s f e r function H( z )
hu = upsample (h , 2 ) ; % Transfer function H( zˆL)
y1 = f i l t e r (h ,1 , x ) ; % F i l t e r i n g
y = upsample (y1 , 2 ) ; % Up−sampling
m = 0: length (y)−1; % Time index
f i g u r e (1)
subplot (3 ,2 ,1) , stem (n , x ) , ylabel ( ’ x [ n ] ’ )
subplot (3 ,2 ,3) , stem (n , y1 ) , ylabel ( ’ y 1 [ n ] ’ )
subplot (3 ,2 ,5) , stem (m, y ) , ylabel ( ’ y [m] ’ )
xlabel ( ’ Time index ’ )
axis ([0 ,30 , −1 ,1])
y2 = upsample (x , 2 ) ; % Up−sampling
y = f i l t e r (hu ,1 , y2 ) ; % F i l t e r i n g
19
subplot (3 ,2 ,2) , stem (n , x , ’ r ’ ) , ylabel ( ’ x [ n ] ’ )
subplot (3 ,2 ,4) , stem (m, y2 , ’ r ’ ) , ylabel ( ’ y 2 [m] ’ )
axis ([0 ,30 , −1 ,1])
subplot (3 ,2 ,6) , stem (m, y , ’ r ’ ) , ylabel ( ’ y [m] ’ )
xlabel ( ’ Time index ’ )
axis ([0 ,30 , −1 ,1])
In figure 40 the left-hand side shows the signals for structure 1, and the right-hand side
presents the signals for structure 2. This results shown in fig. 40 demonstrate the equivalence
of the cascade connections defined by the sixth identity.
Figure 40: Illustration of the sixth identity
Polyphase interpolation
The convolution at the higher sampling rate can be replaced by independent convolutions
at the lower input sampling rate using polyphase decomposition.[1]
H(z) =
L−1
k=0
z−k
Hk(zL
) (8)
In figure 41 we can see the polyphase components of the signal.
20
Next we will show the implementation of the sixth identity in Matlab.
n = 0 : 6 3 ;
h = zeros ( s i z e (n ) ) ; h (11:39) = 0 . 9 5 . ˆ ( 1 : 2 9 ) ; % F i l t e r c o e f f i c i e n t s
hd0 = downsample (h , 4 ) ;
hd1 = downsample (h , 4 , 1 ) ;
hd2 = downsample (h , 4 , 2 ) ;
hd3 = downsample (h , 4 , 3 ) ;
% Up−sampling polyphase components with the phase o f f s e t
h0 = upsample (hd0 , 4 ) ;
h1 = upsample (hd1 , 4 , 1 ) ;
h2 = upsample (hd2 , 4 , 2 ) ;
h3 = upsample (hd3 , 4 , 3 ) ;
subplot (4 ,1 ,1) , stem ( 0 : length ( h0)−1,h0 ) , ylabel ( ’ h0 [m] ’ )
subplot (4 ,1 ,2) , stem ( 0 : length ( h1)−1,h1 ) , ylabel ( ’ h1 [m] ’ )
subplot (4 ,1 ,3) , stem ( 0 : length ( h2)−1,h2 ) , ylabel ( ’ h2 [m] ’ )
subplot (4 ,1 ,4) , stem ( 0 : length ( h3)−1,h3 ) , ylabel ( ’ h3 [m] ’ )
xlabel ( ’ Time index m’ )
Figure 41: Polyphase components
21
References
[1] Jovanovic-Dolecek, G. (2001). Multirate Systems: Design and Applications: Design and
Applications. IGI Global.
[2] Milic, L. (2009). Multirate Filtering for Digital Signal Processing: MATLAB Applications:
MATLAB Applications. IGI Global.
[3] Vaidyanathan, P. P. (1993). Multirate systems and filter banks. Pearson Education India.
22

More Related Content

PPSX
Multirate digital signal processing
PDF
Multirate signal processing and decimation interpolation
PPTX
Multirate DSP
PPTX
Fir filter design (windowing technique)
DOC
Digital Signal Processing Lab Manual ECE students
PPTX
Sampling Theorem and Band Limited Signals
PPTX
FILTER DESIGN
PPTX
Dsp application on mobile communication
Multirate digital signal processing
Multirate signal processing and decimation interpolation
Multirate DSP
Fir filter design (windowing technique)
Digital Signal Processing Lab Manual ECE students
Sampling Theorem and Band Limited Signals
FILTER DESIGN
Dsp application on mobile communication

What's hot (20)

PPT
Multipliers in VLSI
PPTX
Discrete Fourier Transform
PPTX
Equalization
PPT
Analog to digital converters, adc
PPTX
Properties of dft
PDF
Dcs unit 2
PPT
VLSI subsystem design processes and illustration
DOC
DPSK(Differential Phase Shift Keying) transmitter and receiver
PPTX
Realizations of discrete time systems 1 unit
PPTX
FM demodulation using PLL
PPTX
DIGITAL SIGNAL PROCESSING
PPTX
Butterworth filter
PPTX
Adaptive equalization
PPT
Vestigial side band (vsb)
PDF
Digital signal Processing all matlab code with Lab report
PPTX
Chebyshev filter
PPTX
Sampling theorem
PPTX
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
PDF
DSP_FOEHU - Lec 11 - IIR Filter Design
PPT
Monopulse tracking radar
Multipliers in VLSI
Discrete Fourier Transform
Equalization
Analog to digital converters, adc
Properties of dft
Dcs unit 2
VLSI subsystem design processes and illustration
DPSK(Differential Phase Shift Keying) transmitter and receiver
Realizations of discrete time systems 1 unit
FM demodulation using PLL
DIGITAL SIGNAL PROCESSING
Butterworth filter
Adaptive equalization
Vestigial side band (vsb)
Digital signal Processing all matlab code with Lab report
Chebyshev filter
Sampling theorem
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
DSP_FOEHU - Lec 11 - IIR Filter Design
Monopulse tracking radar
Ad

Viewers also liked (13)

PPTX
D ecimation and interpolation
PPT
multirate signal processing for speech
PPTX
Multirate DSP
PPTX
Effects of varying number of samples in an image
PDF
To learn Interpolator
PPTX
Subband Coding
PDF
Multirate
PPTX
FILTER BANKS
PPTX
Verilog
DOCX
Project report on design & implementation of high speed carry select adder
DOCX
VERILOG CODE
PDF
Design of Multiplier Less 32 Tap FIR Filter using VHDL
DOCX
HDL Implementation of Vending Machine Report with Verilog Code
D ecimation and interpolation
multirate signal processing for speech
Multirate DSP
Effects of varying number of samples in an image
To learn Interpolator
Subband Coding
Multirate
FILTER BANKS
Verilog
Project report on design & implementation of high speed carry select adder
VERILOG CODE
Design of Multiplier Less 32 Tap FIR Filter using VHDL
HDL Implementation of Vending Machine Report with Verilog Code
Ad

Similar to Decimation and Interpolation (20)

PPTX
Multirate_Digital_Signal_Processing.pptx
PDF
DSP-Lec 02-Sampling and Reconstruction.pdf
PPTX
Multirate-signal-processing.pptx
PDF
Topic 6 Sampling Rate Conversion (std).pdf
PDF
Digital Signal Processing[ECEG-3171]-Ch1_L06
PDF
Multirate sim
PDF
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
PPTX
LECTURE 01.pptx Digital electronics for engineers
PPT
DSP Unit-VI MULTI RATE ADASDASDASDASDADADA
PPT
DSP unit6 ppt about multirate digital signal processing
PPT
DSP_Unit-lecture notes on different things.ppt
PDF
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
PDF
Introduction to Digital Signal Processing 1st Edition Blandford Solutions Manual
PDF
Sampling and Reconstruction DSP Material.pdf
PPTX
Sampling.pptx
PDF
orfanidis-solutions-book-2nd-edition-pdf
PDF
Signal, Sampling and signal quantization
PDF
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
PPTX
Lecture 18 (5)
Multirate_Digital_Signal_Processing.pptx
DSP-Lec 02-Sampling and Reconstruction.pdf
Multirate-signal-processing.pptx
Topic 6 Sampling Rate Conversion (std).pdf
Digital Signal Processing[ECEG-3171]-Ch1_L06
Multirate sim
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
LECTURE 01.pptx Digital electronics for engineers
DSP Unit-VI MULTI RATE ADASDASDASDASDADADA
DSP unit6 ppt about multirate digital signal processing
DSP_Unit-lecture notes on different things.ppt
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
Introduction to Digital Signal Processing 1st Edition Blandford Solutions Manual
Sampling and Reconstruction DSP Material.pdf
Sampling.pptx
orfanidis-solutions-book-2nd-edition-pdf
Signal, Sampling and signal quantization
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
Lecture 18 (5)

Recently uploaded (20)

PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPT
Total quality management ppt for engineering students
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Current and future trends in Computer Vision.pptx
PDF
PPT on Performance Review to get promotions
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Sustainable Sites - Green Building Construction
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
UNIT 4 Total Quality Management .pptx
PPT
introduction to datamining and warehousing
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Total quality management ppt for engineering students
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Current and future trends in Computer Vision.pptx
PPT on Performance Review to get promotions
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
III.4.1.2_The_Space_Environment.p pdffdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Sustainable Sites - Green Building Construction
Embodied AI: Ushering in the Next Era of Intelligent Systems
R24 SURVEYING LAB MANUAL for civil enggi
UNIT 4 Total Quality Management .pptx
introduction to datamining and warehousing
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding

Decimation and Interpolation

  • 1. Department of Digital Signal Processing Master of Science in Electronics Multirate Systems Homework 1 Decimation and interpolation Dr. Gordana Jovanovic Dolecek Ojeda Loredo Fernando June/15/2015 Sta. Ma. Tonantzintla, Puebla
  • 2. Introduction The decimator is a device that reduces the sampling rate by an integer factor of M, whereas the interpolator is used to increase the rate by L. In many applications the sampling rate of a system needs to be changed for a lower or higher sampling rate for an appropriate processing of the signal, for example in a digital mobile receiver system, the received signal often presents a high frequency which cannot be digitized by the ADC converter , so it needs to be first converted to a lower frequency using an Rf analog downconversion, the resultant frequency is commonly known as intermedia- te frequency, after ADC a FIR filter is used to select a desired bandwidth and then it is downsampled or upsampled to an appropriate sampling rate. In digital audio applications a number of sampling rates coexist, for example, the sampling rate for studio work is 48KHz, whereas for cd production is 44.1KHz, and the broadcast rate is 32KHz.All this rate con- versions can be made using decimators and interpolators devices, systems that use different sampling rates are known as multirate systems.[3] Downsampling The process of downsampling consist in reducing the sampling rate of a signal that is already sampled, by an integer factor M, basically we are resampling the signal, but because we are reducing the sampling rate then we call this as subsampling. When a signal is downsampled we reduce the amount of data by taking only every M-th sample of the signal and discarding all others as we can see in fig 2. Figure 1: Downsampling. Figure 2: Downsampling in time. 1
  • 3. The downsamplig process can be described in time and frequency in two steps: step 1. we obtain a signal x (n) from x(n) by setting all samples whose indexes are not integer multiples of M to zero. We can consider x (n) as a multiplication of x(n) and CM (n) where M denotes the downsamplig factor, in this case we use M = 2 to explain the process. x (n) = x(n)CM (n) (1) We express this signal in matlab as follows: N = 26; n = 0:N-1; x = 0.8*sin(2*pi*0.0625*n)+0.3*sin(2*pi*0.2*n); cm = [zeros(1,26)]; for k = 1:2:26 cm(k) = 1; end x2 = x.*cm; We can see the result of first step in the figure 3 where only every 2n samples of x(n) are taken and the others are set to zero. Figure 3: Step 1, time. This operation does not change the content of the signal x’(n), the spectrum undergoes a replica every 2π/M as we can see in fig. 4, as M = 2 then the spectrum replicas appears every π, where π = 1 in normalized frequency. Because we removed samples in time, in frequency the spectrum is scaled by a factor of 2, we can see this scaling in fig. 4.b. Later in this document we will present the effects of aliasing due to the overlapping of the frequency bands and how we can avoid this undesired effect that distorts the signal. 2
  • 4. Figure 4: Step 1, frequency. step 2. The next step is to remove the zeros in x (n) and thus obtain y(m): y = downsample(x,2); This operation introduce time scaling by a factor of 1/M. Due to te principle of duality in time-frequency, in time we get a compression so we expect an expansion in frequency as we can see in fig 6. The frequency is scaled by a factor of 2. Figure 5: Step 2, scaling in time. Figure 6: Scaling in frequency. 3
  • 5. Aliasing When a signal is downsampled, the replicas generated by the first step can overlap, this occurs if the original signal is not bandlimited to π/M. This overlapping effect is called aliasing, to avoid this we use a low-pass digital filter that should precede the down-sampler, in fig 7 we can see this effect. Figure 7: Aliasing with M = 4. Properties of downsampling A system is said to be linear if it complies whit the principle of superposition T{αx1(n) + βx2(n)} = αTx1(n) + βTx2(n) (2) We demonstrate this principle using MATLAB as follows: N = 16; n = 0:N−1; a = 2; b = 3; x1 = 0.8∗ sin (2∗ pi ∗0.0625∗n ) ; x2 = 0.3∗ sin (2∗ pi ∗0.2∗n ) ; xs = a .∗ x1 + b .∗ x2 ; xsd = downsample ( xs , 2 ) ; % Structure 1 xd1 = downsample (x1 , 2 ) ; xd2 = downsample (x2 , 2 ) ; x12d = a .∗ xd1 + b .∗ xd2 ; % Structure 2 4
  • 6. We observe in fig. 8 that xsd and x12 are equal, thus we prove the linearity of the down- sampling process. Figure 8: linear property. We can also demonstrate this principle using Simulink. Figure 9: Structure 1. Figure 10: Structure 2. If an input signal undergoes a transformation through a system we get a transformed output signal, also if the same input signal is shifted in time k samples then we expect the same transformed output signal but shifted k samples in time, if this is accomplished then we say that the system is time invariant. we will demonstrate the time variance or time invariance of a downsampling process as follows: N = 32; n = 0:N-1; k = 4; x = 0.8*sin(2*pi*0.0625*n); xs = 0.8*sin(2*pi*0.0625*(n - k)); xd = downsample(x,2); xsd = downsample(xs,2); 5
  • 7. We observe in fig. 12 that the downsampled shifted signal xsd does not present the same shift as the input signal xs, thus we conclude downsampling is a time varying operation. Figure 11: Delayed signal by 4 samples. Figure 12: Downsampled delayed signal. When the relation K/M is not an integer the downsampled delayed signal will have a fractional delay, this means that the downsampled signal with no input delay and the downsampled delayed signal will have a different shape as we can see in fig 13. Figure 13: Downsampled signals with fractional delay. 6
  • 8. Downsampling identities First identity This identity follows directly from the principle of superposition, as previously discussed. Second identity Establishes that the delay of M samples before the downsampler is equivalent to a delay of one sample after the downsampler. We will show this second identity using Simulink, as follows: Figure 14: Structure 1. Figure 15: Structure 2. Comparing the two graphics in fig. 16 and fig 17 it follows that structure 1 and structure 2 are equivalent. Figure 16: Structure 1 plot. Figure 17: Structure 2 plot. 7
  • 9. Third identity This identity is related to cascade connection of a linear time invariant system H(Z) and a downsampler. Filtering with H(ZM ) and downsampling by M is equal to the downsampling by M and filtering with H(Z). Figure 18: Third identity structures. The third identity is demonstrated using a filter expanded with M = 4 which precedes the downsampler as can be seen in structure 1 in figure 18. Another filter is designed to implement structure 2, and finally the graphs in figure 19, show this identity, the Matlab implementation is as follows: n = 0 : 6 0 ; % Time index x = cos (2∗ pi ∗0.05∗n ) ; % Generating the o r i g i n a l s i g n a l h = f i r 1 ( 1 0 , 0 . 5 ) ; % Designing the f i l t e r t r a n s f e r function H( z ) hu = upsample (h , 4 ) ; % Transfer function H( zˆM) y1 = f i l t e r (hu ,1 , x ) ; % F i l t e r i n g y = downsample (y1 , 4 ) ; % Down−sampling m = 0: length (y)−1; % Time index f i g u r e (1) subplot (3 ,2 ,1) , stem (n , x ) , ylabel ( ’ x [ n ] ’ ) t i t l e ( ’ Figure 18(a ) ’) subplot (3 ,2 ,3) , stem (n , y1 ) , ylabel ( ’ y 1 [ n ] ’ ) subplot (3 ,2 ,5) , stem (m, y ) , ylabel ( ’ y [m] ’ ) xlabel ( ’ Time index ’ ) y2 = downsample (x , 4 ) ; % down−sampling y = f i l t e r (h ,1 , y2 ) ; % f i l t e r i n g subplot (3 ,2 ,2) , stem (n , x , ’ r ’ ) , ylabel ( ’ x [ n ] ’ ) t i t l e ( ’ Figure 18(b ) ’) subplot (3 ,2 ,4) , stem (m, y2 , ’ r ’ ) , ylabel ( ’ y 2 [m] ’ ) subplot (3 ,2 ,6) , stem (m, y , ’ r ’ ) , ylabel ( ’ y [m] ’ ) xlabel ( ’ Time index ’ ) In figure 19 the left-hand side shows the signals for structure 1, and the right-hand side presents the signals for structure 2. This results shown in fig. 19 demonstrate the equivalence of the cascade connections defined by the third identity. 8
  • 10. Figure 19: Illustration of the third identity. Polyphase decimation The decimation structure consists of two block as can be seen in figure 20, a low-pass filter which discard all frequencies above π/M to avoid aliasing, and the downsamplign block which reduce the sampling rate of the signal. Figure 20: Decimation structure. Usually H(z) is a FIR filter, which consist of N coefficients. If N is a integer multiple of M we can obtain M different discretely sampled components of the impulse response. That means that the corresponding Z-transform ca be partitioned into M sub-signals H(z) = M−1 k=0 z−k Hk(zM ) (3) where Hk(zM ) = N/M−1 n=0 h(nM + k)(zM )−n ) (4) 9
  • 11. The filter shown in the structure from figure 20, can be decomposed as we can observe in figure 21.a this is a direct application of the first identity, now in figure 21.b we can see an application of the third identity. With this implementation we obtain a more efficient version in which both the number of filter operations as well the amount of memory required are reduced by a factor of M. Figure 21: Polyphase decimation. Now we present an example in Matlab with a FIR filter which consist of N = 64 coeffi- cients, an a decimation factor of M = 4, so we expect 4 polyphase components. % Polyphase decomposition c l e a r all , c l o s e a l l % Input s i g n a l n = 0 : 6 3 ; h = zeros ( s i z e (n ) ) ; h (11:39) = 0 . 9 5 . ˆ ( 1 : 2 9 ) ; % Generating the sequence ’h ’ % Polyphase down−sampling with the phase of f s e t 10
  • 12. h0 = downsample (h , 4 ) ; h1 = downsample (h , 4 , 1 ) ; h2 = downsample (h , 4 , 2 ) ; h3 = downsample (h , 4 , 3 ) ; subplot (4 ,1 ,1) , stem ( 0 : length ( h0)−1,h0 ) , ylabel ( ’ h0 [m] ’ ) subplot (4 ,1 ,2) , stem ( 0 : length ( h1)−1,h1 ) , ylabel ( ’ h1 [m] ’ ) subplot (4 ,1 ,3) , stem ( 0 : length ( h2)−1,h2 ) , ylabel ( ’ h2 [m] ’ ) subplot (4 ,1 ,4) , stem ( 0 : length ( h3)−1,h3 ) , ylabel ( ’ h3 [m] ’ ) xlabel ( ’ Time index m’ ) The original signal is shown in figure 22 and the polyphase components are given in 23. Figure 22: Filter Coefficients. Figure 23: Polyphase components. Upsampling Upsampling increases the sampling rate by an integer factor L, by inserting L-1 equally spaced zeros between each pair of samples. y[m] = x[m/L], m = 0, ±L, ±2L, ... 0, Otherwise (5) Where L is called an interpolator factor. The symbol for this operation is a box with an upward-pointing arrow, followed by the interpolator factor.[2] Figure 24: Upsampler. 11
  • 13. The following Matlab code illustrates an example of the upsampler with L = 2. N = 21; % Length of the o r i g i n a l sequence n=0:N−1; % Time index x=0.7∗ sin (2∗ pi ∗0.0625∗n)+0.3∗ sin (2∗ pi ∗0.2∗n ) ; % Original s i g n a l L= 2; % Up−sampling factor y=zeros (1 ,L∗ length (x ) ) ; y ( [ 1 : L: length (y)])= x ; % Up−sampled s i g n a l Ny = length (y)−L+1; % Length of the up−sampled s i g n a l f i g u r e (2) subplot (2 ,1 ,1) stem (0:20 , x ( 1 : 2 1 ) ) xlabel ( ’ Time index n ’ ) , ylabel ( ’ x [ n ] ’ ) subplot (2 ,1 ,2) stem (0:40 , y ( 1 : 4 1 ) ) xlabel ( ’ Time index m’ ) , ylabel ( ’ y [m] ’ ) We can see in figure 25, how the sampling rate is increased also we can see how L-1 equally space zeros are inserted between each pair of samples. Figure 25: upsampling by L = 2. 12
  • 14. Imaging The interpolator consist of two stages as we can see in figure 26, the upsampler block that was previously discussed and a low pass filter that is after the upsampler. Figure 26: Interpolator The process of upsampling introduces the replicas of the main spectra at every 2π/L. This is called imaging, since there are L-1 replicas (images) in 2π. We illustrate this effect next: F = [ 0 , 0 . 2 , 0 . 9 , 1 ] ; A = [ 0 , 1 , 0 , 0 ] ; x = f i r 2 (128 ,F,A) ; X = f f t (x , 1 0 2 4 ) ; f = 0:1/1024:(512 −1)/1024; y1 = upsample (x , 2 ) ; y2 = upsample (x , 3 ) ; y3 = upsample (x , 4 ) ; Y1 = f f t (y1 , 1 0 2 4 ) ; Y2 = f f t (y2 , 1 0 2 4 ) ; Y3 = f f t (y3 , 1 0 2 4 ) ; subplot (4 ,1 ,1) , plot (2∗ f , abs (X( 1 : 5 1 2 ) ) ) , t i t l e ( ’ o r i g i n a l signal ’ ) subplot (4 ,1 ,2) , plot ( f ∗2 , abs (Y1( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 2 ’) subplot (4 ,1 ,3) , plot (2∗ f , abs (Y2( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 3 ’) subplot (4 ,1 ,4) , plot ( f ∗2 , abs (Y3( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 4 ’) In figure 27 we can observe the different replicas for L = 2,3,4. We use the low pass filter to remove these replicas, this filter is called an anti-imaging filter. In Matlab we can show the use of this filter by using the command interp, like the command decimate, this already includes the filter unlike the commands downsample and upsample which do not include it. 13
  • 15. Figure 27: Interpolator Next code show the use of interp, to remove the replicas for L = 4. F = [ 0 , 0 . 2 , 0 . 9 , 1 ] ; A = [ 0 , 1 , 0 , 0 ] ; x = f i r 2 (128 ,F,A) ; X = f f t (x , 1 0 2 4 ) ; f = 0:1/1024:(512 −1)/1024; L = 4; xu = upsample (x ,L ) ; y = interp (x ,L ) ; Xu = f f t (xu , 1 0 2 4 ) ; Y = f f t (y , 1 0 2 4 ) ; subplot (3 ,1 ,1) , plot (2∗ f , abs (X( 1 : 5 1 2 ) ) ) , t i t l e ( ’ o r i g i n a l signal ’ ) subplot (3 ,1 ,2) , plot ( f ∗2 , abs (Xu( 1 : 5 1 2 ) ) ) , t i t l e ( ’ upsampled s i g n a l L = 4 ’) subplot (3 ,1 ,3) , plot (2∗ f , abs (Y( 1 : 5 1 2 ) ) ) , t i t l e ( ’ interpolated signal ’ ) f i g u r e subplot (3 ,1 ,1) , stem (54:74 , x ( 5 5 : 7 5 ) ) ; subplot (3 ,1 ,2) , stem(4∗55−1:4∗74−1,xu(4∗55 −1:4∗74 −1)); subplot (3 ,1 ,3) , stem(4∗55−1:4∗74−1,y(4∗55 −1:4∗74 −1)); 14
  • 16. In the following figure we observe the effect of imaging also is necessary to say that the upsampling process consist of the increase in the sampling rate of the signal, this is known as an expansion in time, by the principle of duality, in the frequency domain we expect a compression as shown in figure 28. Figure 28: Imaging and interpolation in frequency In time something very interesting happens due to the filter, the zeros that are inserted by the upsampler are interpolated, for this reason we call this filter an interpolation filter, we can see it in figure 29, also the frequency spectrum is scaled by a factor of L this is presented in figure 28.c. Figure 29: Interpolation in time 15
  • 17. Properties of upsampling Now we show the linearity of the upsample operation, just like in downsampling we will use the same code but now we use the command upsample instead of downsample as shown next. N = 16; n = 0:N−1; a = 2; b = 3; x1 = 0.8∗ sin (2∗ pi ∗0.0625∗n ) ; x2 = 0.3∗ sin (2∗ pi ∗0.2∗n ) ; xs = a .∗ x1 + b .∗ x2 ; xsd = upsample ( xs , 2 ) ; % Structure 1 xd1 = upsample (x1 , 2 ) ; xd2 = upsample (x2 , 2 ) ; x12d = a .∗ xd1 + b .∗ xd2 ; % Structure 2 We observe in figure 30 that xsd and xsd12 are equal so we can conclude that upsampling is a linear operation. Figure 30: Upsampling linear property 16
  • 18. We also demonstrate this property using Simulink as follows: Figure 31: Structure 1 Figure 32: Structure 2 Now we will show the time varying property of the upsampling block. We suppose that the input of the upsampler has a delay of D samples. x(m − D) (6) The upsampled signal will be: y((m − D)L) = y(mL − DL) = y(n − DL) = y(n − D) (7) Consequently, upsampling is a time-dependent operation. N = 32; n = 0:N−1; k = 9; x = 0.8∗ sin (2∗ pi ∗0.0625∗n ) ; xs = 0.8∗ sin (2∗ pi ∗0.0625∗(n − k ) ) ; xu = upsample (x , 2 ) ; xsu = upsample ( xs , 2 ) ; f i g u r e subplot (2 ,1 ,1) , stem (x , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ x ’ ) , grid ; subplot (2 ,1 ,2) , stem ( xs , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ xs ’ ) , grid ; f i g u r e subplot (2 ,1 ,1) , stem (xd , ’ r ’ , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ xu ’ ) , grid ; subplot (2 ,1 ,2) , stem ( xsd , ’ r ’ , ’ LineWidth ’ , 2 ) , grid , t i t l e ( ’ xsu ’ ) , grid ; In figure 33 xs represent a shifted version of x by 9 samples, in figure 34 xu is the upsampled signal by L = 2 of x and xsu is the upsampled signal of xs. We expect the same amount of delay in xsu and xs, but xsu is shifted by 14 samples unlike xs which is shifted by 9 samples, thus we prove that upsampling is a time-varying operation. 17
  • 19. It is important to mention that unlike downsampling, the upsampled delayed signal and the upsampled signal with no delay will always have the same shape, this is because the delay DL is always an integer. Figure 33: Delayed signal by 9 samples Figure 34: Upsampled delayed signal Upsampling identities We have already seen three useful identities of the downsampled signals, and now we will state the corresponding identities associated with upsampling. Fourth identity We have already demonstrated the fourth identity as it follows from the principle of superposition. Fifth identity This identity states that a delay of one sample before upsampling is equivalent to the delay of L samples after upsampling. Figure 35: Structure 1 Figure 36: Structure 2 18
  • 20. Figure 37 and 38 are equal, so the equivalence of the two structures is confirmed. Figure 37: Structure 1 plot Figure 38: Structure 2 plot Sixth identity States that the filtering followed by upsampling is equivalent to having upsampling first followed by expanded filtering. Figure 39: Sixth identity structures n = 0 : 1 5 ; % Time index x = cos (0.2∗ pi ∗n ) ; % Generating the o r i g i n a l s i g n a l h = f i r 1 ( 1 0 , 0 . 5 ) ; % Designing the f i l t e r t r a n s f e r function H( z ) hu = upsample (h , 2 ) ; % Transfer function H( zˆL) y1 = f i l t e r (h ,1 , x ) ; % F i l t e r i n g y = upsample (y1 , 2 ) ; % Up−sampling m = 0: length (y)−1; % Time index f i g u r e (1) subplot (3 ,2 ,1) , stem (n , x ) , ylabel ( ’ x [ n ] ’ ) subplot (3 ,2 ,3) , stem (n , y1 ) , ylabel ( ’ y 1 [ n ] ’ ) subplot (3 ,2 ,5) , stem (m, y ) , ylabel ( ’ y [m] ’ ) xlabel ( ’ Time index ’ ) axis ([0 ,30 , −1 ,1]) y2 = upsample (x , 2 ) ; % Up−sampling y = f i l t e r (hu ,1 , y2 ) ; % F i l t e r i n g 19
  • 21. subplot (3 ,2 ,2) , stem (n , x , ’ r ’ ) , ylabel ( ’ x [ n ] ’ ) subplot (3 ,2 ,4) , stem (m, y2 , ’ r ’ ) , ylabel ( ’ y 2 [m] ’ ) axis ([0 ,30 , −1 ,1]) subplot (3 ,2 ,6) , stem (m, y , ’ r ’ ) , ylabel ( ’ y [m] ’ ) xlabel ( ’ Time index ’ ) axis ([0 ,30 , −1 ,1]) In figure 40 the left-hand side shows the signals for structure 1, and the right-hand side presents the signals for structure 2. This results shown in fig. 40 demonstrate the equivalence of the cascade connections defined by the sixth identity. Figure 40: Illustration of the sixth identity Polyphase interpolation The convolution at the higher sampling rate can be replaced by independent convolutions at the lower input sampling rate using polyphase decomposition.[1] H(z) = L−1 k=0 z−k Hk(zL ) (8) In figure 41 we can see the polyphase components of the signal. 20
  • 22. Next we will show the implementation of the sixth identity in Matlab. n = 0 : 6 3 ; h = zeros ( s i z e (n ) ) ; h (11:39) = 0 . 9 5 . ˆ ( 1 : 2 9 ) ; % F i l t e r c o e f f i c i e n t s hd0 = downsample (h , 4 ) ; hd1 = downsample (h , 4 , 1 ) ; hd2 = downsample (h , 4 , 2 ) ; hd3 = downsample (h , 4 , 3 ) ; % Up−sampling polyphase components with the phase o f f s e t h0 = upsample (hd0 , 4 ) ; h1 = upsample (hd1 , 4 , 1 ) ; h2 = upsample (hd2 , 4 , 2 ) ; h3 = upsample (hd3 , 4 , 3 ) ; subplot (4 ,1 ,1) , stem ( 0 : length ( h0)−1,h0 ) , ylabel ( ’ h0 [m] ’ ) subplot (4 ,1 ,2) , stem ( 0 : length ( h1)−1,h1 ) , ylabel ( ’ h1 [m] ’ ) subplot (4 ,1 ,3) , stem ( 0 : length ( h2)−1,h2 ) , ylabel ( ’ h2 [m] ’ ) subplot (4 ,1 ,4) , stem ( 0 : length ( h3)−1,h3 ) , ylabel ( ’ h3 [m] ’ ) xlabel ( ’ Time index m’ ) Figure 41: Polyphase components 21
  • 23. References [1] Jovanovic-Dolecek, G. (2001). Multirate Systems: Design and Applications: Design and Applications. IGI Global. [2] Milic, L. (2009). Multirate Filtering for Digital Signal Processing: MATLAB Applications: MATLAB Applications. IGI Global. [3] Vaidyanathan, P. P. (1993). Multirate systems and filter banks. Pearson Education India. 22