Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
44 views

Digital Signal Processing Lab Manual Updated

Uploaded by

sridhar bellala
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Digital Signal Processing Lab Manual Updated

Uploaded by

sridhar bellala
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 85

DIGITAL SIGNAL PROCESSING LAB

(Course Code:19EC603)
B.Tech (Electronics and Communication Engineering)
6thSemester

(Academic year 2021-22)

Name of the Student: _______________________________

Roll No.

Batch: _________

Section: _________

Department of Electronics and Communication Engineering

GMR INSTITUTE OF TECHNOLOGY


(An Autonomous Institute Affiliated to JNTUK, Kakinada)
(Accredited by NBA, NAAC with grade ‘A’ & ISO 9001:2015 Certified Institution)
Approved by AICTE, New Delhi

1
GMR NAGAR, RAJAM-532 127

DIGITAL SIGNAL PROCESSING LAB


(Course Code:16EC703)
List of experiments
*Minimum eleven experiments to be conducted

Page
S.No. Name of the Experiment Marks Signature
Number

1 Generation of Discrete time signals and sum of


sinusoidal signals

2 Estimate the power and power spectral density of the


given sequence

3 Linear convolution of two given sequences of


different lengths

4 Verify the circular convolution of two given


sequences of different lengths

5 Determine the FFT for given sequence using DIT


radix-2 algorithm

6 Implement IIR Butterworth Filter (LP/HP)

7 Implement FIR LP/HP Filter using Windowing


Technique

8 Implementation of Decimation Process

9 Implementation of Interpolation Process

10 Implementation of I/D Sampling Rate Converter

2
Page
S.No. Name of the Experiment Marks Signautre
Number
11 Study of Architecture of DSP Chips- TMS 320C 5X/6X

12 Linear Convolution of two given sequences and plot


using TMS processor

13 Magnitude response of FIR Low pass filter using


Rectangular Windowing Technique

14 Magnitude Response of IIR Low Pass Filter

Marks Avg :

Augmented Experiments:

Page Mark
S.No. Name of the Experiment Signature
Number s
1 Mixing and separation of two voice signals

2 Design chess board

3 Design a notch filter for the removal of power line


interference from ECG signal by using TMS processor

Marks for Augmented Experiment:

Final marks for Record:

3
16EC703 DIGITAL SIGNAL PROCESSING Lab
0032
Course Outcomes

1. Design op-Amp circuits for various applications


2. Demonstrate the practical usage of various linear ICs
3. Design and implement the pulse generator using 555 timer
4. Design and construct the various filters like LPF, HPF,BPF ,BRF
5. Design a function generator
6. Design a converter which converts analog signal to Digital signal and vice versa

COs PO1 PO 2 PO 3 PO 4 PSO1


1 3 2 2 2 3
2 2 2 2
3 3 2 2 2 3
4 3 2 2 2 3
5 3 2 3
6 3 2 2 2 3

3–Strongly linked | 2–Moderately linked| 1–Weakly linked

List of Experiments
Minimum twelve experiments to be conducted:

Implement the following using SCILAB/MATLAB

1. Generation of Discrete time signals and sum of sinusoidal signals

2. Estimate the power of the given signals

3. Linear convolution of two given sequences of different lengths

4. Determine the power spectral density of the given sequence and plot the spectrum

5. Verify the circular convolution of two given sequences of different lengths

6. Determine the FFT for given sequence using DIT radix-2 algorithm

7. Plot the Magnitude and phase response of IIR filter (LP/HP) using Butterworth Filter

8. Plot the Magnitude and phase response FIR LP/HP filter using windowing technique

a) Using rectangular window, b) Using triangular window

9. To study the architecture of DSP chips : TMS 320C 6X Instructions


4
Implement the following using TMS processor

10. Linear convolution of two given sequences and plot

11. DFT of the given sequence and plot Magnitude and Phase response

12. Magnitude response FIR LP filter using rectangular windowing technique

13. Magnitude response IIR LP filter

List of Augmented Experiments

1. Mixing and separation of two voice signals by using SCILAB/MATLAB

2. Design chess board by using SCILAB/MATLAB

3. Design a notch filter for the removal of power line interference from ECG signal by using
TMSprocessor

Reading Material(s)

1. Digital Signal Processing by SanjitK.Mitra 2nd Edition, TATA McGraw Hill

2. Digital Signal Processing, Principles, Algorithms, and Applications: John G. Proakis, Dimitris
G. Manolakis, Pearson Education, PHI, 2007

5
Date:
INTRODUCTION TO MATLAB

6
INTRODUCTION TO MATLAB

7
INTRODUCTION TO MATLAB

8
Date:
EXPERIMENT NO-1
GENERATION OF DISCRETE TIME SIGNALS AND SUM OF SINUSOIDAL SIGNALS

AIM:

To generate basic signals like unit impulse, unit step, unit ramp signal, Exponential signals and
sinusoidal signal.

APPARATUS:

PC with Matlab Software

THEORY:

A Signal is a function of time, space, or another observation variable that conveys information.
They are classified into two types
 Continuous-Time/Analog Signal
 Discrete-Time Signal

Continuous-time (CT)/Analog Signal:

A finite, real-valued, smooth function x(t) of a variable t which usually represents time. Both x
and t in x(t) are continuous

Continuous – time signals:


1, for t  0
 Unit impulse signal. x(t )   (t )  
 0, otherwise
1, for t  0
 Unit step signal. x (t )  u( t )  
 0, otherwise
 t , for t  0
x(t )  r (t )  
 Unit ramp signal.
 0, otherwise

 Sinusoidal signal. x ( t )  A sin(t   ) .


) = A e at signal. 
x ( tExponential , where A and a are constant.

Discrete-time (DT) Signal

A discrete-time signal is a bounded, continuous-valued sequence. Alternately, it may be viewed


as a continuous-valued function of a discrete index n. We often refer to the index n as time, since
discrete-time more correctly, though, n is merely an index that represents sequentially of the
numbers in x (n).

9
Discrete – Time signals:
1, for n  0
x ( n)   ( n)  
 Unit impulse sequence. 0, otherwise
1, for n  0
x ( n )  u( n )  
 Unit step sequence. 0, otherwise
n, for n  0
x ( n)  r ( n)  
 Unit ramp sequence. 0, otherwise
 Sinusoidal sequence. x (n)  A sin(n   ) .

A continuous-time signal x(t) is said to be periodic with period T if it satisfy the condition

x (t+T) = x(t) for all t -∞<t<+∞ ………….eq1

A signal is periodic if the above condition is not satisfied for at least one value of T. The smallest
value of T that satisfies the above condition is known as fundamental period. Complex
exponential and sinusoidal signals are examples for continuous time periodic signals. Consider a
sinusoidal signal

x(t)=Asin(wt+θ) ……………………eq2

Where A is tha amplitude, w is tha frequency in radians per second (rad/sec), and θ the phase in
radians. The frequency f0 in hertz is given by f0 = w /2π or periodic signal we have
X(t+T)=x(t) ………………eq3

For x(t)=Asin(wt+θ) ………………eq4

X (t+T) = Asin [w(t+T)+ θ)] =Asin[wt+wT+θ] ……………eq5

Equation 5 and 2 are equal if wT = 2π , T =2π/ w Thu the sinusoidal is periodic with period 2π/
w The sum of two periodic signals x1(t) and x2(t) with periods T1 and T2 respectively may or
may not be periodic, then the ratio T1/T2 can be written as the ratio a/b of two integers a and b.
If T1/T2 = a/b, then bT1 = aT2, and since a and b are integers, x1(t) and x2(t) are periodic with
period bT1. If a and b are co-prime (i. e. a and b have no common integer factors other than 1)
then T = bT1 is the fundamental period of the sum of two signals.

ALGORITHM:

1. Get the value of n for the sequences.

2. Use the desired formula for generating the signals.

3. Use the keyword stem for generating the discrete signal.

4. Use the keyword plot for generating the continuous signal.

10
5. Plot the graph.

6. Stop.

CODE:

%Basic signals
clc;
clear all;
close all;
n=-20:1:20;

x1=1; x2=0;
xi=x1.*(n==0)+x2.*(n~=0);
subplot(3,2,1);
stem(n,xi);
title('Impulse sequence');

x1=1; x2=0;
xu=x1.*(n>=0)+x2.*(n<0);
subplot(3,2,2);
stem(n,xu);
title('Unit step sequence');

x1=n; x2=0;
xr=x1.*(n>=0)+x2.*(n<0);
subplot(3,2,3);
stem(n,xr);
title('Ramp sequence');

x1=exp(-n); x2=0;
xe=x1.*(n>=0)+x2.*(n<0);
subplot(3,2,4);
stem(n,xe);
title('Exponential sequence');

t=20;
f=1/t;
xs=sin(2*pi*f*n);
subplot(3,2,5);
stem(n,xs);
title('Sinusoidal sequence');

11
%Sum of sinusoidal signals
clc;
clear all;
close all;
n=-20:1:20;
t1=20;
f1=1/t1;
x1=sin(2*pi*f1*n);
subplot(2,2,1);
stem(n,x1);
title('First signal');
t2=40;
f2=1/t2;
x2=sin(2*pi*f2*n);
subplot(2,2,2);
stem(n,x2);
title('Second signal');
xa=x1+x2;
subplot(2,2,3);
stem(n,xa);
title('Sum of first and second signal');

MODEL GRAPHS:

12
PROCEDURE:

1. Click on the MATLAB Icon on the desktop.


2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.

RESULT:

VIVA QUESTIONS:

1. Define impulse signal


2. Define ramp signal
3. Define unit step signal
4. Define exponential signal
5. Define sinusoidal signal
6. Define C.T.S
7. Define D.T.S.
8. Compare C.T.S & D.T.S
9. Draw the C.T.S & D.T.S diagrams

13
Date:
EXPERIMENT -2
ESTIMATE THE POWER AND POWER SPECTRAL DENSITY OF THE GIVEN
SEQUENCE
AIM:

To estimate the power of the given signals.

APPARATUS:

PC with Matlab Software

THEORY:

In general signals can be classified into three broad categories, power signals, energy signals, or
neither. Deterministic signals which are made up of sinusoids is an example of power signals
which have infinite energy but finite average power. Random signals also have finite average
power and fall into the category of power signals. A transient signal is an example of energy
signals which start and end with zero amplitude. There are still other signals which cannot be
characterized as either power or energy signals.

For any signal in discrete form, power and energy can be calculated using the following
equations

Here T=duration of the signal, and x[n] denotes discrete samples of the signal at regular intervals
(The sampled signal contains N points stretching from 0 to N-1). “NORM” function in Matlab
can be utilized for calculating the power or energy content of a signal.

Case Study:

x(t) is a sine wave of amplitude A and frequency fc represented by the following equation.

x(t)=Asin(2πfct)

When represented in frequency domain, it will look like the one on the right side plot in the
following figure. This is evident from the fact that the sinewave can be mathematically
represented by applying Euler’s formula.

14
Asin(2πfct)=A(ej2πfct−e−j2πfct)/2j

When considering the amplitude part, the above decomposition gives two spikes of amplitude
A/2 on either side of the frequency domain at fc and −fc.

Squaring the amplitudes gives the magnitude of power of the individual spikes/frequency
components. The power spectrum is plotted below.

Thus if the pure sine wave is of amplitude A=1V and frequency=100Hz, the power spectrum will
have two spikes of value A2/4=0.25 at 100 Hz and -100 Hz frequencies. The total power will be
A2/4+A2/4=0.25+0.25=0.5W.

Power spectral density (PSD), which describes how the power of a signal or time series is
distributed with frequency. Here power can be the actual physical power, or more often, for
convenience with abstract signals, can be defined as the squared value of the signal, that is, as the
actual power dissipated in a load if the signal were a voltage applied across it. This instantaneous
power (the mean or expected value of which is the average power)

The total or the average power in a signal is often not of as great an interest. We are most
often interested in the PSD or the Power Spectrum. We often want to see is how the input power
has been redistributed by the channel and in this frequency-based redistribution of power is
where most of the interesting information lies. The total area under the Power Spectrum or PSD
is equal to the total average power of the signal. The PSD is an even function of frequency or in
other words To compute PSD:The value of the auto-correlation function at zero-time equals the
total power in the signal. To compute PSD we compute the auto-correlation of the signal and

15
then take its FFT. The auto-correlation function and PSD are a Fourier transform pair. (Another
estimation method called “period gram” uses sampled FFT to compute the PSD.)

Power Spectral Density is a Fourier transform of the auto correlation

ALGORITHM:

1. Get the value of n for the sequences.


2. Use the desired formula for estimating the power of the signals.
3. Plot the graph
4. Generate the noise
5. Add signal and noise
6. Find power spectral density
7. Plot the graph
8. Stop.

CODE:

clc;
clear all;
close all;
N=1024;
fs=8000;
f=input('Enter the frequency[1 to 5000]:');
n=0:N-1;
x=sin(2*pi*(f/fs)*n);
pxx=spectrum(x,N);
specplot(pxx,fs);
grid on;
xlabel('freq(Hz)');
ylabel('magnitude(dB)');
title('Power spectrum of x(n)');
power=0;
for n=1:N
power=power+(norm(x)^2)/N;
end
display(power);

16
MODEL GRAPHS:

PROCEDURE:

1. Click on the MATLAB Icon on the desktop.


2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.

RESULT:

VIVA QUESTIONS:

1. What is energy signal? How to calculate energy of a signal?

2. What is power signal? How to calculate power of a signal?

3. What do you mean by phase spectrum and magnitude spectrum/ give comparison?

4. How do you reduce spectral leakage?

17
5. What do you mean by spectral resolution?

Date:
EXPERIMENT 3
LINEAR CONVOLUTION OF TWO GIVEN SEQUENCES OF DIFFERENT LENGTHS

AIM:

Write a MATLAB Script to perform discrete linear convolution for the given two Sequences and
also prove by manual calculation.

APPARATUS:

PC, MATLAB software

THEORY:

LINEAR CONVOLUTION:
The response y[n] of a LTI system for any arbitrary input x[n] is given by convolution of
impulse response h[n] of the system and the arbitrary input x[n].

 

 x[k ]h[n  k ]  h[k ]x[n  k ]


y[n] = x[n]*h[n] = k   or k  
If the input x[n] has N1 samples and impulse response h[n] has N2 samples then the output
sequence y[n] will be a finite duration sequence consisting of (N 1 + N2 - 1) samples. The
convolution results in a non-periodic sequence called Aperiodic convolution.

STEPS IN LINEAR CONVOLUTION:


The process of computing convolution between x[k] and h[k] involves four steps.
1. Folding: Fold h[k] about k=0 to obtain h[-k]
2. Shifting: Shift h[-k] by ‘n0’to right if ‘n0’ is positive and shift h[-k] by ‘n 0’ to the left
if ‘n0’ is negative. Obtain h[n0-k]
3. Multiplication : Multiply x[k] by h[n0-k] to obtain the product sequence
yn0 [k] = x[k] h [n0 –k]
4. Summation: Find the sum of all the values of the product sequence to obtain values of
output at n = n0
Repeat steps 2 to 4 for all possible time shifts ‘n0’ in the range -  <n< 
18
ALGORITHM:

1. Get two signals g(m) and h(p) in matrix form.


2. The convoluted signal is denoted as y(n).
3. y(n) is given by the formula
i. ∞
ii. y(n) = Σ [ g(k) h (n-k) ] where n=0 to m+p-1
4. Stop.

CODE:

clc;
clear all;
close all;
x=[1,2,3,4,5];
h=[2,3,4];
N1=length(x);
N2=length(h);
N=N1+N2-1;
x=[x,zeros(1,N-N1)];
h=[h,zeros(1,N-N2)];
s=zeros(1,N);
for n=1:N
for k=1:n
s(n)=s(n)+x(k)*h(n-k+1);
end
end
display(s)

n=1:N;
subplot(3,1,1);
stem(n,x);
title('First signal');

subplot(3,1,2);
stem(n,h);
title('Second signal');

subplot(3,1,3);
stem(n,s);
title('Convolution of signal1 and signal2');

19
MODEL GRAPHS:

PROCEDURE:

1. Click on the MATLAB Icon on the desktop.

2. MATLAB window open.

3. Click on the ‘FILE’ Menu on menu bar.

4. Click on NEW M-File from the file Menu.

5. An editor window open, start writing code.

6. Now SAVE the file in directory.

7. Then Click on Run.

RESULT:

20
VIVA QUESTIONS
1. Explain the significance of convolution.
2. Define linear convolution.
3. Why linear convolution is called as a periodic convolution?
4. Why zero padding is used in linear convolution?
5. What are the four steps to find linear convolution?
6. What is the length of the resultant sequence in linear convolution?
7. How linear convolution will be used in calculation of LTI system response?
8. List few applications of linear convolution in LTI system design.
9. Give the properties of linear convolution.
10. How the linear convolution will be used to calculate the DFT of a signal?

21
Date:

EXPERIMENT 4

VERIFY THE CIRCULAR CONVOLUTION OF TWO GIVEN SEQUENCES OF


DIFFERENT LENGTHS

AIM:
Toverify the circular convolution of two given sequences of different lengths
APPARATUS:
PC with Matlab Software
THEORY:
CIRCULAR CONVOLUTION

The convolution of two periodic sequences with period N is called circular convolution of two
signals x1[n] and x2[n] denoted by

N−1 N−1
∑ x1 ∑ x 1( k )
y[n] = x1[n] * x2[n] = k=0 [(n-k) mod N] x2 (k) or k=0 x2 [(n-k) mod N]

Where x1[(n-k) mod N] is the reflected and circularly translated version of x1[n].

x1[n] * x2[n] = IDFTN { DFTN (x1[n] ) . DFTN (x2[n])}

It can be performed only if both the sequences consist of equal number of samples. If the
sequences are different in length then convert the smaller size sequence to that of larger size by
appending zeros

ALGORITHM :

1. Get the two input sequences g(m) and h(p).

2. Get the length of the sequences.

22
3. check whether the lengths are equal using the loop

4. if(N3=0)

h=[h,zeros (1,N3)];

else

g=[g,zeros (1,-N3)];

end

5. Compute the circular convolution of the sequence.

6. y(n) = y(n)+g(i)*h(j);

7. stop.

CODE:

clc;
clear all;
close all;
x=[2,2];
h=[1,1,-1];
l1=length(x);
l2=length(h);
N=max(l1,l2);

x=[x,zeros(1,N-l1)];
subplot(3,1,1);
stem(x);
xlabel('n');
ylabel('x');
title('Sequence1 x=[2,2]');

h=[h,zeros(1,N-l2)];
subplot(3,1,2);
stem(h);
xlabel('n');
ylabel('h');
title('Sequence2 h=[1,1,-1]');

y=zeros(1,N);
for n=1:N
for m=1:N
j=mod(n-m,N);
r=j+1;
y(n)=y(n)+x(m)*h(r);
end
23
end
subplot(3,1,3);
stem(y);
xlabel('n');
ylabel('y');
title('Circular convolution of the given sequences');

MODEL GRAPHS:

PROCEDURE:
1. Click on the MATLAB Icon on the desktop.
2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.

RESULT:

24
VIVA QUESTIONS:

1. What is the requirement for convolution?

2. What is the difference between convolution & correlation?

3. How to compute maximum length N for a circular convolution using DFT and IDFT.
(what is command).

4. If x 1(n)={1,2,3,4} and x 2(n)={5,6,7,8} Find the circular representation for the above
sequences.

25
Date:

EXPERIMENT-5

DETERMINE THE FFT FOR GIVEN SEQUENCE USING DIT RADIX-2 ALGORITHM

AIM:
Write a MATLAB Script to compute Discrete Fourier Transform of the given sequence using
FFT algorithms (DIT-FFT & DIF-FFT)
APPARATUS:
PC with Matlab Software
PROCEDURE:
1. Click on the MATLAB Icon on the desktop.
2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.
THEORY:

DFT is a powerful tool for performing frequency analysis of discrete time signal and it is
described as a frequency domain representation of a DT sequence.
The DFT of a finite duration sequence x[n] is given by
N 1
 x(n)e  j 2πnk/N
X (k) = n0 k=0, 1….N-1
Which may conveniently be written in the form
N 1
 nk
x ( n) w N
X (k) = n0 k=0, 1….N-1
26
Where WN=e-j2/N which is known as Twiddle or Phase factor.

COMPUTATION OF DFT:

To compute DFT, it requires N2 multiplication and (N-1) N complex addition. Direct


computation of DFT is basically inefficient precisely because it does not exploit the symmetry
and periodicity properties of phase factor WN.

FAST FOURIER TRANSFORM (FFT

FFT is a method of having computationally efficient algorithms for the execution of DFT, under
the approach of Divide and Conquer. The number of computations can be reduced in N point
DFT for complex multiplications to N/2log2N and for complex addition to N/2log2N.
Types of FFT are,
(i) Decimation In Time (DIT)
(ii) Decimation In Frequency (DIF)
RADIX-2 DECIMATION IN TIME FFT:
The idea is to successively split the N-point time domain sequence into smaller sub
sequence. Initially the N-point sequence is split into xe[n] and xo[n], which have the even and odd
indexed samples of x[n] respectively. The N/2 point DFT’s of these two sequences are evaluated
and combined to give N-point DFT. Similarly N/2 point sequences are represented as a
combination of two N/4 point DFT’s. This process is continued, until we are left with 2 point
DFT.
RADIX-2 DECIMATION IN FREQUENCY FFT:
The output sequence X(k) is divided into smaller sequence.. Initially x[n] is divided into
two sequences x1[n], x2[n] consisting of the first and second N/2 samples of x[n] respectively.
Then we find the N/2 point sequences f[n] and g[n] as
f[n]= x1[n]+x2[n],
g[n]=( x1[n]-x2[n] )wNk
The N/2 point DFT of the 2 sequences gives even and odd numbered output samples. The above
procedure can be used to express each N/2 point DFT as a combination of two N/4 point DFTs.
This process is continued until we are left with 2 point DFT.
ALGORITHM:
27
1. Determine N
2. Find twiddle factor
3. Computer FFT for each stage
4. Stop

CODE:

clc;
clear all;
close all;
x=input('Enter input sequence');
N=length(x);
%twiddle factor calculation
for i=1:4
w(i)=exp(-j*2*pi*(i-1)/N);
end
y=bitrevorder(x);
%Stage 1
for i=1:2:N
s(i)=y(i)+w(1)*y(i+1);
s(i+1)=y(i)-w(1)*y(i+1);
end
%Stage 2
for i=1:4:N
s1(i)=s(i)+w(1)*s(i+2);
s1(i+1)=s(i+1)+w(3)*s(i+3);
s1(i+2)=s(i)-w(1)*s(i+2);
s1(i+3)=s(i+1)-w(3)*s(i+3);
end
%Stage 3
for i=1:4
s2(i)=s1(i)+w(i)*s1(i+4);
s2(i+4)=s1(i)-w(i)*s1(i+4);
end

k=1:N;
subplot(2,1,1);
stem(k,abs(s2));
title('Magnitude response');
subplot(2,1,2);
stem(k,angle(s2));
title('Phase response');

28
MODEL GRAPHS:

PROCEDURE:
1. Click on the MATLAB Icon on the desktop.
2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.
RESULT:

29
VIVA QUESTIONS:

1. FFT is in complex domain how to use it in real life signals optimally?


2. What is the difference between FFT and IFFT?
3. Explain using convolution the effects of taking an FFT of a sample with no windowing
4. What is the need of FFT?
5. What’s the difference between FFT and DFT?
6. Why do we need Fourier transform in DSP?
7. Give any practical application of fft in daily life?
8. What is the importance of fft in OFDMA technology?
9. In STB DVB how many point fft is currently using?
10. Give FFT & IFFT formulae and calculate for any sequence?
11. What is "decimation-in-time" versus "decimation-in-frequency"?
12. What is "bit reversal"?
13. How does the FFT work?

30
Date:

EXPERIMENT-6

IMPLEMENT IIR BUTTERWORTH FILTER (LP/HP)

AIM:
Write a MATLAB Script to Plot the Magnitude and phase response of IIR filter (LP/HP) using
Butterworth Filter
APPARATUS:
THEORY:

A digital filter is a linear time invariant discrete time system. The digital filters are
classified into two, based on their lengths of impulse response
1. Finite Impulse response (FIR)
They are of non-recursive type and h [n] has finite number of samples
2. Infinite Impulse response (IIR)
h[n] has finite number of samples. They are of recursive type. Hence, their
transfer function is of the form

H ( z )   h( n) z  n
n 0

M 1
 bk Z  k
H (Z )  K  0
N 1
1  a jZ  j
j 1

The digital filters are designed from analog filters. The two widely used methods for
digitizing the analog filters include

31
1. Bilinear transformation
2. Impulse Invariant transformation

The bilinear transformation maps the s-plane into the z-plane by


2 1  Z 1
H (S ) |s  
H(Z) = T 1  Z 1

This transformation maps the jΩ axis (from Ω = -∞ to +∞) repeatedly around the unit circle (exp(
jw), from w=-π to π ) by
2  
 tan  
T 2
BILINEAR TRANSFORMATION:
DESIGN STEPS:
1. From the given specifications, Find pre-warped analog frequencies using
2  
 tan  
T 2
2. Using the analog frequencies, find H(s) of the analog filter

2 1  Z 1
S 
3. Substitute T 1  Z 1 in the H(s) of Step:2

IMPULSE INVARIANT TRANSFORMATION:


DESIGN STEPS:
1. Find the analog frequency using  =  / T
2. Find the transfer function of analog filter Ha(s)
3. Express the analog filter transfer function as a sum of single pole filters
4. Compute H(Z) of digital filter using the formula
N
Ck
H (Z )   TPk Z 1
k 1 1 e
LIBRARY FUNCTIONS:
 Impinvar: Impulse Invariant method for analog-to-digital filter conversion [bz,az] =
impinvar(b,a,fs) creates a digital filter with numerator and denominator coefficients bz
and az, respectively, whose impulse response is equal to the impulse response of the
32
analog filter with coefficients b and a, scaled by 1/fs. If you leave out the argument fs (or)
specify fs as an empty vector [ ], it takes the default value of 1 Hz.

 Bilinear: Bilinear transformation method for analog-to-digital filter conversion. The


bilinear transformation is a mathematical mapping of variables. In digital filtering, it is a
standard method of mapping the s or analog plane into the z or digital plane. It transforms
analog filters, designed using classical filter design
ALGORITHM :

1. Get the pass band and stop band ripples.

2. Get the pass band and stop band edge frequencies.

3. Get the sampling frequency.

4. Calculate the order of the filter using the formula,

N =(log√(10^0.1αs-1)(10^0.1αp-1))/(log(Ωs/Ωp)).

5. Find the filter coefficients.

6. Draw the magnitude and phase responses.

7. Stop.

CODE:

clc;
clear all;
close all;
%Low pass filter
alphap=0.4;
alphas=30;
fp=400;
fs=800;
F=2000;

wp=2*pi*fp/(2*pi*F);
ws=2*pi*fs/(2*pi*F);
[n,wn]=buttord(wp,ws,alphap,alphas);
[b,a]=butter(n,wn);
w=0:0.01:pi;
[H,f]=freqz(b,a,w);

33
subplot(2,1,1);
plot(f/pi,20*log(abs(H)));
title('Magnitude plot');
subplot(2,1,2);
plot(f/pi,angle(H));
title('Phase plot');

%High pass filter


alphap=0.4;
alphas=30;
fp=800;
fs=400;
F=2000;

wp=2*pi*fp/(2*pi*F);
ws=2*pi*fs/(2*pi*F);
[n,wn]=buttord(wp,ws,alphap,alphas);
[b,a]=butter(n,wn,'high');
w=0:0.01:pi;
[H,f]=freqz(b,a,w);
figure;
subplot(2,1,1);
plot(f/pi,20*log(abs(H)));
title('Magnitude plot');
subplot(2,1,2);
plot(f/pi,angle(H));
title('Phase plot');

MODEL GRAPHS:

34
PROCEDURE:
1. Click on the MATLAB Icon on the desktop.

35
2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.

RESULT:

VIVA QUESTION:

1. What do you mean by cut-off frequency?

2. Give the difference between analog and digital filter?

3. What is the difference between type 1 and type 2 filter structure?

4. what is the role of delay element in filter design?

5. Explain how the frequency is filter in filters?

6. Differences between Butterworth chebyshev filters?

7. Can IIR filters be linear phase? How to make it linear Phase?

8. What is the special about minimum phase filter?

36
Date:

EXPERIMENT-7

IMPLEMENT FIR LP/HP FILTER USING WINDOWING TECHNIQUE


AIM:
Write a MATLAB Script to Plot the Magnitude and phase response FIR LP/HP filter using
windowing technique
APPARATUS:
PC with Matlab Software
THEORY:

A digital filter is a discrete time LTI system. It is classified based on the length of the
impulse response as
IIR filters:
Where h [n] has infinite number of samples and is recursive type.
FIR filters:

37
They are non-recursive type and h [n] has finite number of samples.
The transfer function is of the form:
N 1
H ( z )   hn z n
n 0

This implies that it has (N-1) zeros located anywhere in the z-plane and (N-1) poles at Z
= h.
The FIR filter can be designed by:
 Fourier series method
 Frequency sampling method
 Window method
Most of the FIR design methods are interactive procedures and hence require more
memory and execution time. Also implementation of narrow transition band filter is costly. But
there are certain reasons to go for FIR.

TYPES OF WINDOWS:
1. Rectangular
2. Triangular
3. Hamming
4. Hanning
5. Blackman
6. Kaiser
LIBRARY FUNCTIONS:
fir1 FIR filter design using the Window method.
B = fir1(N,Wn) designs an Nth order low pass FIR digital filter and returns the filter
coefficients of vector B of length (N+1). The cut-off frequency Wn must be between 0<Wn<
1.0, with 1.0 corresponding to half the sample rate. The filter B is real and has linear phase.
The normalized gain of the filter at Wn is -6 dB.
B = fir1(N,Wn,'high') designs an Nth order high pass filter. You can also use
B = fir1(N,Wn,'low') to design a low pass filter.
If Wn is a two-element vector, Wn = [W1 W2], fir1 returns an order N band pass filter with pass
band W1 < W < W2.You can also specify B = fir1(N,Wn,'bandpass'). If Wn = [W1 W2], B =
fir1(N,Wn,'stop') will design a band-stop filter.

38
If Wn is a multi-element vector, Wn = [W1 W2 W3 W4 W5 ... WN], fir1 returns a N-order
multi-band filter with
bands 0< W < W1, W1 < W < W2, ..., WN < W < 1.
B = fir1(N,Wn,'DC-1') makes the first band a pass band.
B = fir1(N,Wn,'DC-0') makes the first band a stop band.
B = fir1(N,Wn,WIN) designs an N-th order FIR filter using the vector WIN of (N+1) length to
window the impulse response. If empty or omitted, fir1 uses a Hamming window of length N+1.
For a complete list of available windows, see the Help for the WINDOW function. KAISER and
CHEBWIN can be specified with an optional trailing argument. For example, B =
fir1(N,Wn,kaiser(N+1,4)) uses a Kaiser window with beta=4. B =
fir1(N,Wn,'high',chebwin(N+1,R)) uses a Chebyshev window with R decibels of relative
sidelobeattenuation.For filters with a gain other than zero at Fs/2, e.g., high pass and band stop
filters, N must be even. Otherwise, N will be incremented by one. In this case, the window
length should be specified as N+2. By default, the filter is scaled so the center of the first pass
band has magnitude exactly one after windowing. Use a trailing 'noscale' argument to
prevent this scaling, e.g.

B = fir1(N,Wn,'noscale'), B = fir1(N,Wn,'high','noscale'),
B = fir1(N,Wn,wind,'noscale'). You can also specify the scaling explicitly, e.g.
fir1(N,Wn,'scale'), etc.
We can specify windows from the Signal Processing Toolbox, such as boxcar, hamming,
hanning, bartlett, blackman, kaiser or chebwin
w = hamming(n) returns an n-point symmetric Hamming window in the column vector w. n
should be a positive integer.
w = hanning(n) returns an n-point symmetric Hann window in the column vector w. n must be a
positive integer.
w=triang(n) returns an n-point triangular window in the column vector w. The triangular
window is very similar to a Bartlett window. The Bartlett window always ends with zeros at
samples 1 and n, while the triangular window is nonzero at those points. For n odd, the center (n-
2) points of triang(n-2) are equivalent to bartlett(n).
w = rectwin(n) returns a rectangular window of length n in the column vector w. This function is
provided for completeness. A rectangular window is equivalent to no window at all

ALGORITHM :

1. Clear all the m-files &close them.

2. Get wc1 & wc2 values.

3. Calculate hd(n), hw(n), h(n) for various values for rectangular window.

39

hd(n)=1/2π∫H(e^jω).e^jωhω(n)=1.
-∞
4. Calculate hd(n), w(n), h(n) for various values for hamming window.

hd(n)=1/πn sin(πn/2).

hω(n) = {0.54+0.46 cos(2πn/N-1) ; -(N+1/2)≤n≤(N-1/2)


{0 ; otherwise.
{I○(β)/I○(α) ; -(N+1/2)≤n≤(N-1/2)
{0 ;else.
β =α (1-(2n/N-1)^2)^1/2.
5. Plot the graph.

6. Stop.

CODE:

clc;
clear all;
close all;
wc=0.5*pi;
N=25;
n=0:1:(N-1);
alpha=(N-1)/2;
hd=sin(wc*(n-alpha+0.001))./((n-alpha+0.001)*pi);
wt=boxcar(N);
w=0:0.01:pi;
hn=hd.*wt(N);
h=freqz(hn,1,w);
figure;
subplot(2,1,1);
plot(w/pi,abs(h));
title('Magnitude plot');
subplot(2,1,2);
plot(w/pi,angle(h));
title('Phase response');

40
MODEL GRAPHS

PROCEDURE:
1. Click on the MATLAB Icon on the desktop.
2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run
RESULT:

41
VIVA QUESTION:

1. What is FIR and IIR filter define, and distinguish between these two?

2. What is window method? How you will design an FIR filter using window method?

3. What are low-pass and band-pass filter and what is the difference between these two?

7. What do you mean by built in function ‘abs’ and where it is used?

8. Explain how the FIR filter are stable?

9. Why is the impulse response "finite"?

10. What are the advantages of FIR Filters (compared to IIR filters)?

11. What are the disadvantages of FIR Filters (compared to IIR filters)?

12. What terms are used in describing FIR filters?

13. What is the delay of a linear-phase FIR?

14. What is the frequency response formula for a FIR filter?

15. What is the DC gain of a FIR filter?

Date:

EXPERIMENT-8

IMPLEMENTATION OF DECIMATION PROCESS


AIM:
To verify the decimator for a given sequence with factor M=2,3
APPARATUS:
PC with Matlab Software
THEORY:
“Decimation” is the process of reducing the sampling rate.
“Downsampling” is a more specific term which refers to just the process of throwing away
samples, without the lowpass filtering operation. The most immediate reason to decimate is
simply to reduce the sampling rate at the output of one system so a system operating at a lower
sampling rate can input the signal. But a much more common motivation for decimation is to
reduce the cost of processing: the calculation and/or memory required to implement a DSP

42
system generally is proportional to the sampling rate, so the use of a lower sampling rate usually
results in a cheaper implementation.

ALGORITHM :

1. Define down sampling factor and input frequencies f1 and f2


2. Represent input sequence with frequencies f1 and f2
3. Perform the decimation on input signal
4. Plot the input and output sequence
5. Stop

CODE:

clc;
clear all;
close all;
N=input('Enter the number of samples: ');
D=input('Enter the decimation factor: ');
f=input('Enter the frequency: ');
t=0:0.001:1;
n=0:N-1;
x=sin(2*pi*f*t);
subplot(2,1,1);
stem(n,x(1:N));
y=decimate(x,D);
m=0:(N/D)-1;
subplot(2,1,2);
stem(m,y(1:(N/D)));

MODEL GRAPHS

43
PROCEDURE:
1. Click on the MATLAB Icon on the desktop.
2. MATLAB window open.
3. Click on the ‘FILE’ Menu on menu bar.
4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.

RESULT:

44
VIVA QUESTIONS:

1. What is the requirement for convolution?

2. What is the difference between convolution & correlation?

3. How to compute maximum length N for a circular convolution using DFT and IDFT.
(what is command).

4. If x 1(n)={1,2,3,4} and x 2(n)={5,6,7,8} Find the circular representation for the above
sequences.

Date:

EXPERIMENT-9
IMPLEMENTATION OF INTERPOLATION PROCESS
AIM:
To verify the Interpolation of a given sequence.
APPARATUS:
PC with Matlab Software
THEORY:

“Upsampling” is the process of inserting zero-valued samples between original samples to


increase the sampling rate. (This is called “zero-stuffing”)

“Interpolation”, is the process of upsampling followed by filtering. The filtering removes


the undesired spectral images. The primary reason to interpolate is simply to increase the

45
sampling rate at the output of one system so that another system operating at a higher
sampling rate can input the signal.

ALGORITHM :

1. Define up sampling factor and input frequencies f1 and f2


2. Represent input sequence with frequencies f1 and f2
3. Perform the interpolation on input signal
4. Plot the input and output signal/sequence
5. Stop

CODE:
clc;
clear all;
close all;
N=input('Enter the number of samples: ');
L=input('Enter the interpolation factor: ');
f=input('Enter the frequency: ');
t=0:0.001:1;
n=0:N-1;
x=sin(2*pi*f*t);
subplot(2,1,1);
stem(n,x(1:N));
y=interp(x,L);
m=0:(N*L)-1;
subplot(2,1,2);
stem(m,y(1:(N*L)));

46
MODEL GRAPHS

PROCEDURE:

1. Click on the MATLAB Icon on the desktop.


2. MATLAB window open.

3. Click on the „FILE‟ Menu on menu bar.


4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.

RESULT:

47
VIVA QUESTION:

1. Explain about multi rate digital signal processing.


2. List the Applications of multi rate digital signal processing.
3. Define interpolation.
4. Define aliasing.

Date:

EXPERIMENT-10
IMPLEMENTATION OF I/D SAMPLING RATE CONVERTER

AIM:
To verify the Interpolation of a given sequence.
APPARATUS:
PC with Matlab Software
THEORY:
"Multirate" means "multiple sampling rates". A multirate DSP system uses multiple
sampling rates within the system. Whenever a signal at one rate has to be used by a
system that expects a different rate, the rate has to be increased or decreased, and some
processing is required to do so. Therefore "Multirate DSP" refers to the art or science of
changing sampling rates. "Resampling" means combining interpolation and decimation to
48
change the sampling rate by a rational factor. Resampling is done to interface two systems
with different sampling rates.

ALGORITHM :

1. Define up sampling factor, down sampling and input frequencies f1 and f2


2. Represent input sequence with frequencies f1 and f2
3. Perform I/D sampling rate conversion on input signal
4. Plot the input and output signal/sequence
5. Stop

CODE:
clc;
clear all;
close all;
N=input('Enter the number of samples: ');
L=input('Enter the interpolation factor: ');
D=input('Enter the decimation factor: ');
f=input('Enter the frequency: ');
t=0:0.001:1;
n=0:N-1;
x=sin(2*pi*f*t);
subplot(2,1,1);
stem(n,x(1:N));
y=resample(x,L,D);
m=0:(N*L/D)-1;
subplot(2,1,2);
stem(m,y(1:(N*L/D)));

49
MODEL GRAPHS

PROCEDURE:
1. Click on the MATLAB Icon on the desktop.
2. MATLAB window open.

3. Click on the „FILE‟ Menu on menu bar.


4. Click on NEW M-File from the file Menu.
5. An editor window open, start writing code.
6. Now SAVE the file in directory.
7. Then Click on Run.
RESULT:

50
VIVA QUESTION:

1. Explain about multi rate digital signal processing.

2. List the Applications of multi rate digital signal processing.

3. Define interpolation.

4. Define decimation.

5. Define aliasing.

6. What is meant anti aliasing?

7. What is the effect of anti imaging filter?

8. Define sampling rate.

9. What is the use of sampling rate convertors?

Date:

EXPERIMENT-11

STUDY OF ARCHITECTURE OF DSP CHIPS-TMS 320C 5X/6X

AIM:

To study the Architecture of DSP chips-TMS 320c 5x/6xinstructions.

THEORY:

Introduction to DSP processors:

A signal can be defined as a function that conveys information, generally about the state or
behavior of a physical system. There are two basic types of signals viz. Analog (continuous time
signals which are defined along a continuum of times) and Digital (discrete-time).Remarkably,
under reasonable constraints; a continuous time signal can be adequately represented by samples,
obtaining discrete time signals. Thus digital signal processing is an ideal choice for anyone who
needs the performance advantage of digital manipulation along with today’s analog reality.
Hence a processor which is designed to perform the special operations (digital manipulations) on
51
the digital signal within very less time can be called as a Digital signal processor. The difference
between a DSP processor, conventional microprocessor and a microcontroller are listed below.

Microprocessor or General Purpose Processor such as Intel xx86 or Motorola 680xx


family

Contains - only CPU

-No RAM

-No ROM

-No I/O ports

-No Timer

Microcontroller such as 8051 family

Contains - CPU

- RAM

- ROM

-I/O ports

- Timer &

- Interrupt circuitry

Some Micro Controllers also contain A/D, D/A and Flash Memory

DSP Processors such as Texas instruments and Analog Devices

Contains - CPU

- RAM

-ROM

- I/O ports

- Timer

Optimized for – fast arithmetic

- Extended precision

52
- Dual operand fetch

- Zero overhead loop

- Circular buffering

Architecture of 6713 dsp processor

This chapter provides an overview of the architectural structure of the TMS320C67xx DSP,
which comprises the central processing unit (CPU), memory, and on-chip peripherals. The
C67xE DSPs use an advanced modified Harvard architecture that maximizes processing power
with eight buses Separate program and data spaces allow simultaneous access to program
instructions and data, providing a high degree of parallelism. For example, three reads and one
write can be performed in a single cycle. Instructions with parallel store and application-specific
instructions fully utilize this architecture. In addition, data can be transferred between data and
program spaces. Such Parallelism supports a powerful set of arithmetic, logic, and bit-
manipulation operations that can all be performed in a single machine cycle. Also, the C67xx
DSP includes the control mechanisms to manage interrupts, repeated operations, and function
calling.

53
Bus Structure

The C67xx DSP architecture is built around eight major 16-bit buses (four program/data buses
and four address buses):

 The program bus (PB) carries the instruction code and immediate operands from program
memory.

 Three data buses (CB, DB, and EB) interconnect to various elements, such as the CPU,
data address generation logic, program address generation logic, on-chip peripherals, and
data memory.

 The CB and DB carry the operands that are read from data memory.

 The EB carries the data to be written to memory.

 Four address buses (PAB, CAB, DAB, and EAB) carry the addresses needed for
instruction execution.
Central Processing Unit (CPU)

 The CPU is common to all C67xE devices. The C67x CPU contains:

 40-bit arithmetic logic unit (ALU)

 Two 40-bit accumulators

 Barrel shifter

 17 × 17-bit multiplier

 40-bit adder

 Compare, select, and store unit (CSSU)

 Data address generation unit

 Program address generation unit


Arithmetic Logic Unit (ALU)

The C67x DSP performs 2s-complement arithmetic with a 40-bit arithmetic logic unit (ALU)
and two

40-bit accumulators (accumulators A and B). The ALU can also perform Boolean operations.
The ALU

uses these inputs:

 16-bit immediate value


54
 16-bit word from data memory

 16-bit value in the temporary register, T

 Two 16-bit words from data memory

 32-bit word from data memory

 40-bit word from either accumulator


The ALU can also function as two 16-bit ALUs and perform two 16-bit operations
simultaneously.

OBSERVATIONS:

55
RESULT: The architecture of DSP chips-TMS 320c 5x/6x is studied successfully.

VIVA QUESTIONS

1. Define signal and signal processing

2. Differentiate digital and analog signals?

3. How the DSP processor will differ from conventional processors?

4. Expand the abbreviation TMS320C 5X/6X

5. What kind of processor is DSP processor?

6. What are the main building blocks of DSP processor?

7. What is the main function of MAC unit?

8. Explain VLIW architecture?

9. What is meant by circular buffer?

10. What is meant by emulator and JTAG?

56
Date:
EXPERIMENT-12
LINEAR CONVOLUTION OF TWO GIVEN SEQUENCES AND PLOT USING TMS
PROCESSOR
AIM:

To verify the linear convolution of two sequences using DSK6713 processor

SOFTWARE REQUIRED:

Operating System - Windows XP

Software – CODE COMPOSER STUDIO

HARDWARE REQUIRED:

DSK 6713 DSP Trainer kit.

USB Cable

Power supply

PC

THEORY:

LINEAR CONVOLUTION:
The response y[n] of a LTI system for any arbitrary input x[n] is given by convolution of
impulse response h[n] of the system and the arbitrary input x[n].

 

 x[k ]h[n  k ]  h[k ]x[n  k ]


y[n] = x[n]*h[n] = k   or k  
57
If the input x[n] has N1 samples and impulse response h[n] has N2 samples then the output
sequence y[n] will be a finite duration sequence consisting of (N 1 + N2 - 1) samples. The
convolution results in a non-periodic sequence called Aperiodic convolution.
STEPS IN LINEAR CONVOLUTION:
The process of computing convolution between x[k] and h[k] involves four steps.
1. Folding: Fold h[k] about k=0 to obtain h[-k]
2. Shifting: Shift h[-k] by ‘n0’to right if ‘n0’ is positive and shift h[-k] by ‘n 0’ to the left
if ‘n0’ is negative. Obtain h[n0-k]
3. Multiplication : Multiply x[k] by h[n0-k] to obtain the product sequence
yn0 [k] = x[k] h [n0 –k]
4. Summation: Find the sum of all the values of the product sequence to obtain values of
output at n = n0
Repeat steps 2 to 4 for all possible time shifts ‘n0’ in the range -  <n< 

PROCEDURE:

1. Open code composer studio

2. Create a new project, give a meaningful name ,save into working folder, select target as

TMS320C6713,and select output file type is execution. out.

3. Click on file open→new→source file save it with .c extension in working folder and
write .ccode for desired task.

4. Add c-file to project as a source [path source→add files to project→add c. file].

5. Add the linker command file→hello .cmd.[path c.\ccstudiov3.1\tutorial\dsk67/3\HELLO1\


Hello.cmd]

6. Add the run time support library file rts6700.lib.[path c.\ccstudio-v.3.1\c600\cg

tools\lib\rts6700.lib].

7. Compile the program [path project→compile file]

10. Build the program [path project→build]

11. Connect the kit to the system through the USB cable

12. Then switch on the kit


58
13. And now check the DSK6713 diagnostics kit whether all the connections are

Made correctly or not

14. Then select [debug→connect] on the cc studio window

15. Load the program [file→load program]

16. Run the program [debug→run].

59
CODE:

60
RESULT:

61
VIVA QUESTIONS

1. Explain the significance of convolution.

2. Define linear convolution.

3. Why linear convolution is called as a periodic convolution?

4. Why zero padding is used in linear convolution?

5. What are the four steps to find linear convolution?

6. What is the length of the resultant sequence in linear convolution?

7. How linear convolution will be used in calculation of LTI system response?

8. List few applications of linear convolution in LTI system design.

9. Give the properties of linear convolution.

10. How the linear convolution will be used to calculate the DFT of a signal?

Date:

62
EXPERIMENT 13:
MAGNITUDE RESPONSE OF FIR LOW PASS FILTER USING RECTANGULAR
WINDOWING TECHNIQUE
AIM:
To find Magnitude response of FIR Low pass filter using rectangular windowing technique CC
STUDIO.
SOFTWARE REQUIRED:

Operating System - Windows XP

Software – CODE COMPOSER STUDIO

HARDWARE REQUIRED:

DSK 6713 DSP Trainer kit.

USB Cable

Power supply

PC

THEORY:

A digital filter is a discrete time LTI system. It is classified based on the length of the impulse
response as
IIR filters:
Where h [n] has infinite number of samples and is recursive type.
FIR filters:
They are non-recursive type and h [n] has finite number of samples.
The transfer function is of the form:
N 1
H ( z )   hn z n
n 0

This implies that it has (N-1) zeros located anywhere in the z-plane and (N-1) poles at Z = h.

The fir filter can be designed by:


 Fourier series method
 Frequency sampling method
 Window method

Most of the FIR design methods are interactive procedures and hence require more memory and
execution time. Also implementation of narrow transition band filter is costly. But there are
certain reasons to go for FIR.
63
PROCEDURE TO CREATE NEW PROJECT:

1. To create project, go to Project and Select New.

2. Give project name and click on finish.

(Note: Location must be c:\CCStudio_v3.1\MyProjects)

3. Click on File → New → Source File, to write the Source Code.

64
4. Enter the source code and save the file with “.C” extension.

5. Right click on source, Select add files to project and Choose “.C “ file Saved before.

65
6. Right Click on libraries and select add files to Project and choose

C:\CCStudio_v3.1\C6000\cgtools\lib\rts6700.lib and click open.

7. a) Go to Project to Compile .

b) Go to Project to Build.

c) Go to Project to Rebuild All.

66
8. Go to file and load program and load “.out” file into the board..

1. Go to Debug and click on run to run the program.

67
2. Observe the output in output window.

3. To see the Graph go to View and select time/frequency in the Graph, And give the
correct Start

address provided in the program, Display data can be taken as per user.

68
CODE:

69
RESULT:

VIVA QUESTIONS

1. What is a filter?

2. Differentiate analog filter and digital filter.

3. Define FIR filter.

4. What are the differences between recursive and non recursive systems?

5. List a few Applications of FIR filters.

6. Explain advantages of FIR filters over IIR filters.

7. Explain limitations of FIR filters.

8. What is the different method to design FIR filters?

9. Explain different window functions.

10. Differentiate rectangular, triangular and Kaiser windows.

70
Date:
EXPERIMENT 14:
MAGNITUDE RESPONSE OF IIR LOW PASS FILTER
AIM:
To find Magnitude response of IIR Low pass filter using CC STUDIO.
SOFTWARE REQUIRED:

Operating System - Windows XP

Software – CODE COMPOSER STUDIO

HARDWARE REQUIRED:

DSK 6713 DSP Trainer kit.

USB Cable

Power supply

PC

THEORY:

A digital filter is a linear time invariant discrete time system. The digital filters are
classified into two, based on their lengths of impulse response
1. Finite Impulse response (FIR)
They are of non-recursive type and h [n] has finite number of samples
2. Infinite Impulse response (IIR)
h[n] has finite number of samples. They are of recursive type. Hence, their
transfer function is of the form

H ( z )   h( n) z  n
n 0

M 1
 bk Z  k
H (Z )  K  0
N 1
1  a jZ  j
j 1

The digital filters are designed from analog filters. The two widely used methods for
digitizing the analog filters include
71
1. Bilinear transformation
2. Impulse Invariant transformation

The bilinear transformation maps the s-plane into the z-plane by


2 1  Z 1
H (S ) |s  
H(Z) = T 1  Z 1

This transformation maps the jΩ axis (from Ω = -∞ to +∞) repeatedly around the unit circle (exp(
jw), from w=-π to π ) by
2  
 tan  
T 2
BILINEAR TRANSFORMATION:
DESIGN STEPS:
1. From the given specifications, Find pre-warped analog frequencies using
2  
 tan  
T 2
2. Using the analog frequencies, find H(s) of the analog filter

2 1  Z 1
S 
3. Substitute T 1  Z 1 in the H(s) of Step:2

IMPULSE INVARIANT TRANSFORMATION:


DESIGN STEPS:
1. Find the analog frequency using  =  / T
2. Find the transfer function of analog filter Ha(s)
3. Express the analog filter transfer function as a sum of single pole filters
4. Compute H(Z) of digital filter using the formula
N
Ck
H (Z )  
1  e TPk Z
1

k 1

72
PROCEDURE TO CREATE NEW PROJECT:

1. To create project, go to Project and Select New.

2. Give project name and click on finish.

(Note: Location must be c:\CCStudio_v3.1\MyProjects)

3. Click on File → New → Source File, to write the Source Code.

73
4. Enter the source code and save the file with “.C” extension.

5. Right click on source, Select add files to project and Choose “.C “ file Saved before.

74
6. Right Click on libraries and select add files to Project and choose

C:\CCStudio_v3.1\C6000\cgtools\lib\rts6700.lib and click open.

7. a) Go to Project to Compile .

b) Go to Project to Build.

c) Go to Project to Rebuild All.

75
8. Go to file and load program and load “.out” file into the board..

4. Go to Debug and click on run to run the program.

76
5. Observe the output in output window.

6. To see the Graph go to View and select time/frequency in the Graph, And give the
correct Start

address provided in the program, Display data can be taken as per user.

77
CODE:

78
RESULT:

VIVA QUESTIONS

1. List some advantages of digital filters over analog filters.

2. Write some differences between FIR and IIR filters.

3. What are the different methods to design IIR filters?

4. Why IIR filters are not reliable?

5. What are different applications of IIR filters?

6. What are advantages of IIR filters?

7. What are disadvantages of IIR filters?

79
Date:

Augmented Experiment:

80
81
82
83
84
85

You might also like