Decimation and interpolation in digital signal processing

Directory

  • Preface
  • 1. Extraction
    • 1.1 Overview of extraction principle
    • 1.2 Spectrum analysis of the extracted signal
  • 2. Interpolation
    • 2.1 Overview of interpolation principles
    • 2.2 Spectrum analysis of the interpolated signal
  • 3.MATLAB simulation

Foreword

Hello everybody! This is Xiao Rui. This article will introduce the related content of extraction and interpolation.

1. Extraction

1.1 Overview of extraction principle

Let the original sampling sequence be

x

(

n

)

x(n)

x(n), its corresponding sampling frequency is

f

s

f_s

fs?, the spectrum is

X

(

e

j

w

)

X(e^{jw})

X(ejw).
Extraction is to extract

x

(

n

)

x(n)

x(n) extracts every D data to form a new sequence

x

D

(

m

)

x_D(m)

xD?(m), where D is the extraction rate.
Right now

x

D

(

m

)

=

x

(

D

m

)

x_D(m)=x(Dm)

xD?(m)=x(Dm).

The purpose of extraction is toreduce the sampling rate of the signal.

x

(

n

)

x(n)

x(n) is obtained after D times extraction

x

D

(

m

)

x_D(m)

The sampling rate of xD?(m) becomes

f

s

D

\dfrac{f_s}{D}

Dfs.
The extraction link is generally located after the receiving end A/D, and is used to slow down the high-speed data stream sampled by the A/D, thereby reducing the requirements for subsequent processing speed.

1.2 Spectrum analysis of the extracted signal

Extract the spectrum of the sequence

X

D

(

e

j

w

)

X_D(e^{jw})

XD?(ejw) is actually the spectrum of the original sequence

X

(

e

j

w

)

X(e^{jw})

The superposition sum of D spectra after X(ejw) is frequency shifted and D times broadened.
Right now

X

D

(

e

j

w

)

X_D(e^{jw})

XD?(ejw)=

1

D

l

=

0

D

?

1

X

[

e

j

(

w

?

2

π

l

)

/

D

]

\dfrac{1}{D}\sum\limits_{l=0}^{D-1}X[e^{j(w-2\pi l)/D}]

D1?l=0∑D?1?X[ej(w?2πl)/D]

Only the conclusion is given here. The derivation process can be found in this article: Frequency domain analysis of extraction and interpolation

Extractionimproves the frequency domain resolution. The high and low frequency components of the extracted spectrum have serious aliasing, making the

X

D

(

e

j

w

)

X_D(e^{jw})

XD?(ejw) can no longer be restored

X

(

e

j

w

)

X(e^{jw})

The spectral component of interest in X(ejw). Therefore, before extraction, the signal is usually

x

(

n

)

x(n)

Perform anti-aliasing filtering on x(n) to obtain

X

(

e

j

w

)

X^{‘}(e^{jw})

X′(ejw), such that

X

(

e

j

w

)

X(e^{jw})

X(ejw)only contains less than

π

D

\dfrac{\pi}{D}

The frequency component of Dπ?. This way

X

D

(

e

j

w

)

X_D(e^{jw})

XD?(ejw)and

X

(

e

j

w

)

X^{‘}(e^{jw})

The spectral components of

π

D

\dfrac{\pi}{D}

Dπ? low-pass filter. when

X

(

e

j

w

)

X(e^{jw})

X(ejw) itself is less than

π

D

\dfrac{\pi}{D}

When Dπ?, the pre-low-pass filter can be omitted.

Note: here

π

D

\dfrac{\pi}{D}

Dπ? refers to the digital frequency, and the corresponding analog frequency is

f

s

2

D

\dfrac{f_s}{2D}

2Dfs, analog frequency

f

f

f and digital frequency

w

w

The relationship between w is

f

=

f

s

2

π

?

w

f=\dfrac{f_s}{2\pi}·w

f=2πfs?w

2. Interpolation

2.1 Overview of interpolation principle

Interpolation is where

x

(

n

)

x(n)

Insert between two adjacent points of x(n)

(

I

?

1

)

(I-1)

(I?1) zero values, forming a new sequence

x

I

(

m

)

x_I(m)

xI?(m), where I is the interpolation rate.
Right now

x

I

(

m

)

=

{

x

(

m

I

)

m

=

0

,

±

I

,

±

2

I

,

.

.

.

0

Others

x_I(m)=\begin{cases}x(\frac{m}{I}) & amp;m=0,\pm I,\pm 2I,… \0 & amp ;Others\end{cases}

xI?(m)={x(Im?)0?m=0,±I,±2I,…others?

The purpose of interpolation is toincrease the sampling rate,

x

I

(

m

)

x_I(m)

The sampling rate of xI?(m) becomes

I

f

s

If_s

Ifs?.
The interpolation link is generally located in front of the transmitter D/A so that the rate can meet the D/A requirements. The use of interpolation can not onlyincrease the frequency of the output signal, but also improve the time domain resolution.

2.2 Spectrum analysis of the interpolated signal

Interpolating zeros does not change the structure of the original spectrum. Interpolated signal spectrum

X

I

(

e

j

w

)

X_I(e^{jw})

XI?(ejw) is the original sequence spectrum

X

(

e

j

w

)

X(e^{jw})

X(ejw)经

I

I

The spectrum obtained after I-fold compression.
Right now

X

I

(

e

j

w

)

=

X

(

e

j

w

I

)

X_I(e^{jw})=X(e^{jwI})

XI?(ejw)=X(ejwI)

The derivation process can be found in this article: Frequency domain analysis of extraction and interpolation

X

I

(

e

j

w

)

X_I(e^{jw})

XI?(ejw) not only contains

X

(

e

j

w

)

X(e^{jw})

The baseband component of X(ejw), and there are also newly generated high-frequency images (ie frequencies greater than

π

/

I

\pi/I

part of π/I), so in order to get from

X

I

(

e

j

w

)

X_I(e^{jw})

To restore the original spectrum in XI?(ejw), the interpolated signal must also be low-pass filtered.

3.MATLAB simulation

Reference procedure:

% =========D_I.m==================
% Author: Classmate Xiaorui
% Date: 2023.10.30
% Description: Extraction and interpolation simulation
% Source: Learning experience
% ================================
clc;
clear;
fs=100;
f1=10;
f2=20;
nfft=512;
t=1/fs:1/fs:1;
f=(1:nfft/2)*fs/nfft;

%%
%original signal
xn=sin(2*pi*f1*t) + 2*sin(2*pi*f2*t);
subplot(331);
plot(t,xn);
title('original signal');xlabel('t/s');ylabel('amplitude/v');
%Spectrum of the original signal
A=abs(fft(xn,nfft));
subplot(332);
plot(f,A(1:nfft/2));
title('Spectrum of the original signal');xlabel('f/Hz');ylabel('Amplitude/v');

%%
%extract sequence
D=8;
xd=xn(1:D:length(xn));
td=1/fs:1/fs:length(xd)/fs;
subplot(334);
plot(td,xd);
title('Extract sequence');xlabel('t/s');ylabel('amplitude/v');
%Directly extract the spectrum obtained
A_D=abs(fft(xd,nfft));
subplot(335);
plot(f,A_D(1:nfft/2));
title('The spectrum obtained by direct extraction');xlabel('f/Hz');ylabel('amplitude/v');
%The spectrum obtained by filtering first and then extracting
wd=1/D;%wd=(2*cutoff frequency)/fs=(2*fs/D/2)/fs=1/D
bd=fir1(150,wd,'low');
xn_filter=filter(bd,1,xn);
xn_filter_D=xn_filter(1:D:length(xn_filter));
A_filter_D=abs(fft(xn_filter_D,nfft));
subplot(336);
plot(f,A_filter_D(1:nfft/2));
title('Spectrum extracted after anti-aliasing filtering');xlabel('f/Hz');ylabel('Amplitude/v');

%%
% interpolation sequence
I=8;
xi=zeros(1,length(xn)*I);
xi(1:I:length(xi))=xn;
ti=1/fs:1/fs:length(xi)/fs;
subplot(337);
plot(ti,xi);
title('Interpolation sequence');xlabel('t/s');ylabel('amplitude/v');
%Interpolated spectrum
A_I=abs(fft(xi,nfft));
subplot(338);
plot(f,A_I(1:nfft/2));
title('Interpolated spectrum');xlabel('f/Hz');ylabel('amplitude/v');
%The spectrum obtained by low-pass filtering after interpolation
wi=1/I;
bi=fir1(80,wi,'low');
xi_filter=filter(bi,1,xi);
A_I_filter=abs(fft(xi_filter,nfft));
subplot(339);
plot(f,A_I_filter(1:nfft/2));
title('Spectrum obtained by low-pass filtering after interpolation');xlabel('f/Hz');ylabel('Amplitude/v');

Simulation results:

  • It can be seen that decimation broadens the spectrum of the original sequence, and decimation after filtering reduces aliasing.
  • Interpolation compresses the spectrum of the original sequence, and filtering after interpolation obtains the spectrum shape of the original signal.

If you think the article is helpful to you, please like and follow it. See you in the next issue!