Exp - 4 DSP
Exp - 4 DSP
The following figure shows a typical M-fold decimation filter, where M is the integer value
by which you want to decrease the sampling frequency. This filter contains a lowpass
FIR filter H(z). This lowpass FIR filter is an anti-aliasing filter followed by an M-fold
decimator. The decimator passes every Mth sample and discards the other samples.
After this operation, the decimation filter changes the sampling frequency fs of the input
signal x(n) to a new sampling frequency fs/M. The decimation filter then returns an
output signal y(n) with the new sampling frequency.
To prevent aliasing, this system uses the lowpass filter H(z) before the M-fold decimator
to suppress the frequency contents above the frequency fs/(2M), which is the Nyquist
frequency of the output signal. This system produces the same results as an analog
anti-aliasing filter with a cutoff frequency of fs/(2M) followed by an analog-to-digital (A/D)
converter with a sampling frequency of fs/M.
//Decimation of a signal
clc ;
clear ;
close ;
// generation of input signal
N = input ( ’ enter the number of points in input signal N= ’ ) ;
n =0:1: N -1
A = input ( ’ enter the amplitude of input sinusoidal signal A= ’ ) ;
f = input ( ’ enter the frequency of input sinusoidal signal fo= ’ ) ;
x = A * sin (2* %pi * f * n ) ;
disp ( x );
// plotting the input signal
subplot (2 ,1 ,1) ;
plot2d3 (n ,x ) ;
xlabel ( ‘discrete time n ’ ) ;
ylabel ( ‘amplitude ’ ) ;
title ( ’ input signal x ( n ) ’ ) ;
// generation of decimation signal
M = input ( ‘ enter the decimation factor M= ’ ) ;
n1 =1:1: N / M ;
x1 = x (1: M : N )
disp ( x1 ) ;
// plotting the decimation signal
subplot (2 ,1 ,2) ;
plot2d3 ( n1 -1 , x1 ) ;
xlabel ( ’ discrete time n ’ ) ;
ylabel ( ’ amplitude ’ ) ;
title ( ’ decimated signal x (Mn) ’ ) ;
// enter the number of points in input signal N=10
// enter the amplitude of input sinusoidal signal A=1
// enter the frequency of input sinusoidal signal f o=0.1
Output: