100% found this document useful (1 vote)
3K views50 pages

DSP Lab Manual - DSP (KEC-553) - 2021-22

The document provides information about the Digital Signal Processing Lab course at NOIDA Institute of Engineering and Technology. It includes the institute and department visions and missions, as well as the program educational objectives, specific outcomes, and outcomes for the Electronics and Communication Engineering program. It also outlines the objectives and outcomes of the Digital Signal Processing Lab course, which involve developing skills in MATLAB tools, digital signal processing concepts like DFT and convolution, and designing IIR and FIR filters. Safety guidelines for the lab are also provided.

Uploaded by

Ayush Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views50 pages

DSP Lab Manual - DSP (KEC-553) - 2021-22

The document provides information about the Digital Signal Processing Lab course at NOIDA Institute of Engineering and Technology. It includes the institute and department visions and missions, as well as the program educational objectives, specific outcomes, and outcomes for the Electronics and Communication Engineering program. It also outlines the objectives and outcomes of the Digital Signal Processing Lab course, which involve developing skills in MATLAB tools, digital signal processing concepts like DFT and convolution, and designing IIR and FIR filters. Safety guidelines for the lab are also provided.

Uploaded by

Ayush Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

NOIDA INSTITUTE OF ENGINEERING AND TECHNOLOGY,

GREATER NOIDA
(An Autonomous Institute)
Accredited by NAAC and Approved by AICTE
(Affiliated to Dr. A.P.J. Abdul Kalam Technical University, Uttar
Pradesh, Lucknow)

LABORATORY MANUAL
COURSE: B.TECH. (EC) SEMESTER: V

DIGITAL SIGNAL PROCESSING LAB


(KEC-553)
School of Electronics
Department of Electronics & Communication Engineering
(Accredited by NBA)
2021-22
Digital Signal Processing Lab KEC 553

INSTITUTE VISION

To be an institute of academic excellence in digital arena with global outreach delivering


socially responsible professionals to become a university and an entrepreneurial hub.

INSTITUTE MISSION

• To impart quality education and hone student’s skills and competencies making them
future ready.
• To foster an ecosystem for research, product development, innovation, incubation and
entrepreneurship.
• To instill values and ethics to produce socially responsible technocrats addressing global
problems.
• To develop an environment for sharing and exchange of resources globally for lifelong
learning.

DEPARTMENT VISION

To prepare the students for global competence, with core knowledge in Electronics and
Communication Engineering having focus on research to meet the needs of industry and
society.
DEPARTMENT VISION

M1: To become dynamic and vigorous knowledge hub with an exposure to state of art
technologies for connecting world.

M2: To provide in-depth knowledge of Electronics and Communication Engineering


ensuring the effective teaching learning process.

M3: To train students to take up innovative projects in group with sustainable and
inclusive technology relevant to the industry and social needs.

M4: To empower students to become skilled and ethical entrepreneurs.

M5: To promote and adapt professional development in a perpetual demanding


environment and nurture the best minds for the future.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 2


Digital Signal Processing Lab KEC 553

PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)

The graduates will be able to:

PEO1: To have excellent scientific and engineering breath as to comprehend,


analyze,design, and solve real life problems using state-of-the-art techniques.

PEO2: To lead a successful career in industries or pursue higher studies or


entrepreneurial endeavors.

PEO3: Toeffectively bridge the gap between industry and academics for
effectivecommunication skill, professional attitude, and a desire to learn.

PROGRAM SPECIFIC OUTCOMES (PSOs)

PSO1: Apply the knowledge of mathematics, science, and electronics & communication
engineering to work effectively in the industry based on same or related area.

PSO2: Use their skills to work in modern electronics & communication engineering tools,
software, and equipment’s to design solutions for complex problems in the related
field that meet the specified needs of the society.

PSO3: Function effectively as an individual and as a member or leader of a team by


qualifying through examinations like GATE, IES, PSUs, TOEFL, GMAT and GRE
etc.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 3


Digital Signal Processing Lab KEC 553

PROGRAM OUTCOMES (POs)

The Program Outcomes (POs) are described as.

PO1: Engineering Knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals and an engineering specialization to the solution of complex engineering
problems.
PO2: Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
PO3: Design / Development of solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex engineering
activities with an understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
PO9: Individual and teamwork: Function effectively as an individual and as a member or
leader in diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for and have the preparation and ability to engage
in independent and lifelong learning in the broadest context of technological change.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 4


Digital Signal Processing Lab KEC 553

COURSE OBJECTIVES

1. To develop the knowledge of MATLAB tools.


2. To provide the practical knowledge about DFT, FFT and types of convolution.
3. To develop the skills of designing the different types of IIR& FIR filter structures.
4. To study and awareness about the DSP processor and its architecture.
5. Provide the understanding of code composer studio and Scilab.

COURSE OUTCOMES

At the end of this course students will demonstrate the ability to:
1. Create and visualize various discrete/digital signals using MATLAB/Scilab.
2. Implement and test the basic operations of Signal processing.
3. Examine and analyze the spectral parameters of window functions.
4. Design IIR and FIR filters for band pass, band stop, low pass and high pass filters.
5. Design the signal processing algorithms using MATLAB/Scilab

MAPPING OF COS AND POS& PSOS

PO’s
PO12

PSO1
PO10

PO11

PSO2

PSO3
PO8
PO7

PO9
PO6
PO3
PO1

PO2

PO4

PO5

CO’s

KEC553. 1 3 1 1 3 2 3 2
KEC553. 2 3 2 2 3 2 3 2

KEC553. 3 3 2 2 3 2 3 2

KEC553.4 3 2 2 3 2 3 2

KEC553.5 3 3 2 3 2 3 2
Average 3 2 1.8 2.4 2 3 2

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 5


Digital Signal Processing Lab KEC 553

GENERAL SAFETY GUIDELINES

Following safety guidelines must be followed while performing lab experiments:

1. Student entry in the lab is ensured strictly as per the allocated time slots or seeking prior
proper permission from the lab faculty or instructor.
2. Students are expected to conduct themselves in a responsible manner while working in the
laboratory.
3. They should keep their bags on the shelf provided outside the lab and carry only essential
items such as lab record, manual, pen-pencil, copy and calculator etc. inside the lab.
4. Students are not allowed to carry food items (not even chewing gum), beverages and water
bottles while working in the laboratory.
5. They are expected to observe good housekeeping practices and ensure equipment, sitting
stools and components to be handled carefully and kept at proper place after finishing the
work to keep the lab clean and tidy.
6. While working in the lab
 Avoid stretching electrical cables and connectors while using the equipment.
 Rig the circuit and get it verified from the lab instructor before connecting it to
power source.
 Pay proper attention towards earthling of electrical equipment. Ensure proper
ventilation in the lab while working.
 Ensure use of wire clippers, insulating tape, plug-pins to prevent any electrical
shocking hazards.
 In case of any short circuit, sensing burning smell or observing any smoke
switch off power supply and immediately report to the faculty/lab instructor
available in the lab.
7. In case of any minor injury please contact the lab instructor or lab faculty. The first aid Box
is available in the department in front of Room No 208.
8. In case of any fire emergency, contact the faculty or lab instructor. For your information, the
fire safety equipment is available on each floor near notice board.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 6


Digital Signal Processing Lab KEC 553

INSTRUCTIONS TO STUDENTS FOR WRITING THE RECORD

In the record, the index page should be filled properly by writing the corresponding experiment
number, experiment name, date on which it was done and the page number.

On the right-side page of the record following has to be written:


1. Title: The title of the experiment should be written in the page in capital letters.
2. In the left top margin, experiment number and date should be written.
3. Aim: The purpose of the experiment should be written clearly.
4. Apparatus/Tools/Equipment/Components used: A list of the Apparatus/Tools/ Equipment’s/
Components used for doing the experiment should be entered.
5. Theory: Simple working of the circuit/experimental set up/algorithm should be written.
6.Procedure: Steps for doing the experiment and recording the readings should be briefly
described(flow chart/ Circuit Diagrams / programs in the case of computer/processor related
experiments)
7. Results: The results of the experiment must be summarized in writing and should be fulfilling
the aim.

On the Left side page of the record following has to be recorded:


1. Circuit/Program: Neatly drawn circuit diagrams for the experimental set up.
2. Design: The design of the circuit components for the experimental set up for selecting the
components should be clearly shown if necessary.
3. Observations:
 Data should be clearly recorded using Tabular Columns.
 Unit of the observed data should be clearly mentioned
 Relevant calculations should be shown. If repetitive calculations are needed, only show a
sample calculation and summarize the others in a table.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 7


Digital Signal Processing Lab KEC 553

EVALUATION SCHEME

B.TECH. ELECTRONICS & COMMUNICATION ENGINEERING


YEAR 3rd/ SEMESTER V

Course Code Course Title


Department Elective-I
KEC-051 Computer Architecture and Organization
KEC-052 Industrial Electronics
KEC-053 VLSI Technology
KEC-054 Advance Digital Design using Verilog
Department Elective-II
KEC-055 Electronics Switching
KEC-056 Advance Semiconductor Device
KEC-057 Electronic Instrumentation and Measurements
KEC-058 Optical Communication

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 8


Digital Signal Processing Lab KEC 553

LIST OF EXPERIMENTS AS PER AKTU SYLLABUS

1. Introduction to MATLAB and or Open-Source Software, Scilab (Using Spoken Tutorial


MOOCs).
2. Write a Program for the generation of basic signals such as unit impulse, unit step, ramp,
exponential, sinusoidal and cosine.
3. Implement IIR Butterworth analog Low Pass for a 4 KHz cut off frequency.
4. Verify Blackman and Hamming windowing techniques.
5. Evaluate 4-point DFT of and IDFT of x(n) = 1, 0 ≤ n ≤ 3; 0 elsewhere.
6. Verify Linear convolution of two sequences using FFT
7. Verify Circular Convolution of two sequences using FFT.
8. To verify FFT as sample interpolator.
9. To implement Tone Generation.
10. To implement floating point arithmetic.
11. To study about DSP Processors and architecture of TMS320C6713 DSP processor.
12. VIRTUAL Lab by NME-ICT available at: (Through Virtual Lab)
12.1 Study of Discrete Fourier Transform (DFT) and its inverse.
12.2 Study of FIR filter design using window method: Lowpass and high pass filter.
12.3 Study of FIR filter design using window method: Bandpass and Band stop filter.
12.4 Study of Infinite Impulse Response (IIR) filter.

Virtual Lab Link:


http://vlabs.iitkgp.ernet.in/dsp/index.html#
http://vlabs.iitkgp.ernet.in/dsp/

Available on: http://www.vlab.co.in/broad-area-electronics-and-communications\

Spoken Tutorial (MOOCs):


Spoken Tutorial MOOCs, ' Course on Scilab', IIT Bombay (http://spoken-tutorial.org/)

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 9


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-1
OBJECTIVE

Introduction to MATLAB and or Open Source Software, Scilab (Using Spoken TutorialMOOCs).

INTRODUCTION TO MATLAB:

MATLAB stands for matrix laboratory. It is a technical computing environment for high
performance numeric computation and visualization developed by Math Works, Inc. (an American
privately held corporation that specializes in mathematical computing software). It integrates
numerical analysis, matrix computation, signal processing and graphics and is an easy-to-use
environment, where problems and solutions are expressed just as they are written mathematically,
without traditional programming. MATLAB allows expressing the entire algorithm in a few dozen
lines, to compute the solution with great accuracy in a few minutes on a computer, and to readily
manipulate a three-dimensional display of the result in color.

MATLAB is an interactive system whose basic data element is a matrix that does not require
dimensioning. It enables us to solve many numerical problems in a fraction of the time that it
would take to write a program and execute in language such as FORTRAN, BASIC, or C. It also
features a family of application specific solutions, called toolboxes. Areas in which toolboxes are
available include signal processing, image processing, control systems design, dynamic systems
simulation, system identification, neural networks, wavelength communication and others. It can
handle linear, non-linear, continuous-time, discrete-time, multivariable and multirate systems.

Starting MATLAB:

Enter MATLAB by double-clicking on the MATLAB shortcut icon (MATLAB R2017a) on your
Windows desktop. When you start MATLAB, a special window called the MATLAB desktop
appears. The desktop is a window that contains other windows. The major tools within or
accessible from the desktop are:
 The Command Window
 The Command History
 The Workspace
 The Current Directory
 The Help Browser

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 10


Digital Signal Processing Lab KEC 553

Fig. 1.1: The graphical interface to the MATLAB


When MATLAB is started for the first time, the screen looks like the one that shown in the Figure
1.1. This illustration also shows the default configuration of the MATLAB desktop. You can
customize the arrangement of tools and documents to suit your needs.

WORKING PROCEDURE WITH MATLAB:

1. Double click on Matlab icon. -> Then Matlab will be opened


2. To write the Matlab Program :Go to file menu-> New -> Script(Mfile) -> In the opened
Script file write the Matlab code and save the file with an extension of .m e.g.: ―linear.m‖
3. To execute Matlab Program Select the all lines in MATLAB program (ctrl+A) of mfile and
press ―F9‖ to execute the MATLAB code.
4. Entering the inputs in command window
 If the command window is displaying the message like ―enter the input sequence‖
then enter the sequence with square brackets and each sample values is spaced with
single space Ex: Enter input sequence [1 2 3 4]
 If it is asking a value input write the value without brackets
Ex: ―enter length of sequence 4‖
 After entering inputs it displays the Output Graphs.
RESULT:

MATLAB are studied successfully.

VIVA QUESTIONS
1. Explain the application of MATLAB
2. Differentiate digital and analog signals?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 11


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-2

OBJECTIVE:
Write a MATLAB Program for the generation of basic signals such as unit impulse, unit step,
ramp, exponential, sinusoidal and cosine.

EQUIPMENT REQUIRED:

Hardware required Software Required


PC MATLAB R2017a

PROGRAM: -
clc;
clear all;
close all;
n=-10:1:10;
L=length(n);
for i=1:L
if n(i)==0
x1(i)=1;
else
x1(i)=0;
end;
if n(i)>=0
x2(i)=1;
x3(i)=n(i);
else
x2(i)=0;
x3(i)=0;
end;
end;
% to generate exponential sequence
a=0.85;
x4=a.^n;
% to generate sinusoidal sequence
f=0.1;
x5=sin(2*pi*f*n);
figure;
subplot(3,2,1);
stem(n,x1);
xlabel('time n ---->');

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 12


Digital Signal Processing Lab KEC 553

ylabel('amplitude---->');
title('Unit impulse signal');
subplot(3,2,2);
stem(n,x2);
xlabel('time n ---->');
ylabel('amplitude---->');
title('Unit step signal')
subplot(3,2,3);
stem(n,x3);
xlabel('time n ---->');
ylabel('amplitude---->');
title('Unit remp signal');
subplot(3,2,4);
stem(n,x4);
xlabel('time n ---->');
ylabel('amplitude---->');
title('exponential signal');
subplot(3,2,[5,6]);
stem(n,x5);
xlabel('time n ---->');
ylabel('amplitude---->');
title('sinusoidal signal');

OUTPUT:

RESULT:
Basic functions such as unit impulse, unit step, ramp, exponential, sinusoidal and cosine are
generated successfully using MATLAB.

VIVA QUESTIONS:
1. What are Singularity functions and how they are related to each other?
2. How step and ramp functions are plotted in MATLAB?
3. How sinusoidal functions can be plotted in MATLAB?
4. How can we label x axis and y axis of any waveform output in MATLAB?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 13


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-3

OBJECTIVE

Implement IIR Butterworth analog Low Pass for a 4 KHz cut off frequency.

EQUIPMENT REQUIRED:

Hardware Required Software Required


PC MATLAB R2017a,fda tool (filter design and analysis tool)

THEORY:
Filter Designer is a powerful graphical user interface (GUI) in the Signal Processing Toolbox for
designing and analysing filters. Filter Designer enables you to quickly design digital FIR or IIR
filters by setting filter performance specifications, by importing filters from your MATLAB
workspace or by adding, moving, or deleting poles and zeros. Filter Designer also provides tools
for analyzing filters, such as magnitude and phase response plots and pole-zero plots.

Type fdatool at the MATLAB command prompt:


>>fdatool

A Tip of the Day dialog displays with suggestions for using Filter Designer. Then, the GUI
displays with a default filter.
The GUI has three main regions:
1) The Current Filter Information region
2) The Filter Display region and
3) The Design panels

The upper half of the GUI displays information on filter specifications and responses for the
current filter. The Current Filter Information region, in the upper left, displays filter properties,
namely the filter structure, order, number of sections used and whether the filter is stable or not. It
also provides access to the Filter manager for working with multiple filters. The Filter Display
region, in the upper right, displays various filter responses, such as, magnitude response, group
delay and filter coefficients. The lower half of the GUI is the interactive portion of Filter Designer.
The Design Panel, in the lower half is where the filter specifications are displayed. It controls what
is displayed in the other two upper regions. Other panels can be displayed in the lower half by
using the sidebar buttons.

Infinite impulse response (IIR) is a property applying to many linear time-invariant systems.
Common examples of linear time-invariant systems are most electronic and digital filters. Systems
with this property are known as IIR systems or IIR filters and are distinguished by having
an impulse response which does not become exactly zero past a certain point, but continues
indefinitely.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 14


Digital Signal Processing Lab KEC 553

Low Pass Butterworth Filter Design


The frequency response of the Butterworth Filter approximation function is also often referred to
as ―maximally flat‖ (no ripples) response because the pass band is designed to have a frequency
response which is as flat as mathematically possible from 0Hz (DC) until the cut-off frequency at -
3dB with no ripples. Higher frequencies beyond the cut-off point rolls-off down to zero in the stop
band at 20dB/decade or 6dB/octave. This is because it has a ―quality factor‖, ―Q‖ of just 0.707.

PROGRAMMING STEPS:
1. Type fdatool in MATLAB command prompt.
2. Under response type panel select Lowpass.
3. Under Design method panel select IIR Butterworth.
4. Specify any filter order.
5. Under frequency specifications specify cut off frequency fc as 4 kHz.
6. Under Analysis button in the fdatool window you can observe various responses like
magnitude response, phase response etc. for the filter.
7. Using realize model button on the left corner of fda tool we can see the block diagram of the
filter.
This panel displays the different analysis
OUTPUT responses for the filter. In this case phase
response.

In this panel we can specify the cut off

Here we can specify the design method for the filter. In this case frequency for filter in Hz or KHz.
choose IIR Butterworth type design method. Above this panel we
can choose the response type of filter lowpass or highpass.

Fig 3.1: FDA Tool Window in MATLAB

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 15


Digital Signal Processing Lab KEC 553

Fig. 3.2: FDA tool window output group delay response of filter

Fig 3.3: FDA tool output for Pole zero plot of filter

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 16


Digital Signal Processing Lab KEC 553

RESULT:
IIR Butterworth filter is implemented successfully using MATLAB fda tool.

VIVAQUESTIONS:
1. What is IIR filter?
2. What are the design methods available for a Butterworth filter?
3. How many kinds of responses are available for a filter?
4. What is fda tool?
5. What are the different design methods available for IIR filter?
6. How many kinds of responses we can model for a filter using fda tool?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 17


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-4

OBJECTIVE:
Verify Blackman and Hamming windowing techniques.

EQUIPMENT REQUIRED:
Hardware required Software Required
PC MATLAB R2017a

THEORY: Blackman windows are defined as:

By common convention, the unqualified term Blackman window refers to Blackman's "not very
serious proposal" of α = 0.16 (a0 = 0.42, a1 = 0.5, a2 = 0.08), which closely approximates the "exact
Blackman", with a0 = 7938/18608 ≈ 0.42659, a1 = 9240/18608 ≈ 0.49656, and a2 =
1430/18608 ≈ 0.076849. These exact values place zeros at the third and fourth side lobes but result
in a discontinuity at the edges and a 6 dB/oct fall-off. The truncated coefficients do not null the side
lobes as well but have an improved 18 dB/oct fall-off.

A filter designed with the Hamming window has minimum stopband attenuation of 53dB, which is
enough for most implementations of digital filters. The transition region is somewhat wider than
that of the Hann and Bartlett-Hanning windows, whereas the stopband attenuation is considerably
higher. Unlike minimum stopband attenuation, the transition region can be changed by changing
the filter order. The transition region narrows, whereas the minimum stopband attenuation remains
unchanged as the filter order increases. The Hamming window coefficients are expressed as:

The windows in MATLAB can be implemented using two ways-

1) Using WVtool or Window Visualisation tool in MATLAB


WVtool (Window Vector) opens the Window Visualization Tool (WVTool) with time and
frequency domain plots of the window vector specified in Window Vector. Window Vector must
be a real-valued row or column vector. By default, the frequency domain plot is the magnitude
squared of the Fourier transform of the window vector in decibels (dB).
w = blackman(N) returns the N-point symmetric Blackman window in the column vector w,
where N is a positive integer = blackman(N,SFLAG) returns an N-point Blackman window using

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 18


Digital Signal Processing Lab KEC 553

the window sampling specified by 'sflag', which can be either 'periodic' or 'symmetric' (the default).
The 'periodic' flag is useful for DFT/FFT purposes, such as in spectral analysis. The DFT/FFT
contains an implicit periodic extension and the periodic flag enables a signal windowed with a
periodic window to have perfect periodic extension. When 'periodic' is
specified, blackman computes a length N+1 window and returns the first N points. When using
windows for filter design, the 'symmetric' flag should be used.w = hamming (L) returns an L-point
symmetric Hamming window.w = hamming (L,sflag) returns a Hamming window using the
window sampling specified by sflag.

2) Using MATLAB coding


PROGRAM:
Create a 64-point Blackman window. Display the result using WVtool.
L = 64;
wvtool(blackman(L));

Fig 4.1: Blackman window output using wvtool in MATLAB

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 19


Digital Signal Processing Lab KEC 553

Create a 64-point Hamming window. Display the result using WV tool.


L = 64;
wvtool(hamming(L))

Fig 4.2: Hamming window output using WVtool in MATLAB

MATLAB programme for Blackman Window function

clc;
clear all;
close all;
wc=0.5*pi;
N=25;
b=fir1(N,wc/pi,blackman(N+1));
w=0:.01:pi;
h=freqz(b,1,w);
plot(w/pi,abs(h),'-.');grid;
xlabel('Normalised frequency\omega/\pi');
ylabel('Magnitude');
title('Frequency response of blackman window');

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 20


Digital Signal Processing Lab KEC 553

MATLAB programme for Hamming Window function


clc;
clear all;
close all;
wc=0.5*pi;
N=25;
b=fir1(N,wc/pi,hamming(N+1));
w=1:.01:pi;
h=freqz(b,1,w);
plot(w/pi,abs(h));
grid;
ylabel('Magnitude');
xlabel('normalized freq\omega/\pi');
title('Frequency response of hamming window');

OUTPUT:

RESULT:
The Blackman and Hamming windows have been verified using MATLAB using WVtool and
coding.

VIVA QUESTIONS
1. What is hamming window function?
2. What is Blackman window function?
3. What is WVtool? Explain the syntax and execution.
4. How can we implement blackman window using WVtool?
5. How can we implement the hamming window using WVtool?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 21


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-5

OBJECTIVE:
Evaluate 4-point DFT and IDFT of x(n) = 1, 0 ≤ n ≤ 3; 0 elsewhere.

EQUIPMENT REQUIRED:
Hardware required Software Required
PC MATLAB R2017a

THEORY:
Given a sequence of N samples s[n], indexed by n = 0..N-1, the Discrete FourierTransform (DFT)
is defined as X(k), where k=0..N-1:
𝑁−1 −𝑗 2𝜋𝑛𝑘 /𝑁
X(k)= 𝑛=𝑜 𝑥(𝑛)𝑒 0≤𝑘 ≤𝑁−1 (i)
X[k] are often called the 'Fourier Coefficients' or 'Harmonics'. The sequence x[n] can be calculated
from X[k] using the Inverse Discrete Fourier Transform
𝑗 2𝜋𝑛𝑘
1 𝑁−1
x(n) =
𝑁 𝑘=0 𝑋 𝑘 𝑒 𝑁 0≤𝑛 ≤𝑁−1 (ii)

In general, both x[n] and X[k] are complex.

The DFT is the most important discrete transform, used to perform Fourier analysis in many
practical applications. In digital signal processing, the function is any quantity or signal that varies
over time, such as the pressure of a sound wave, a radio signal, or daily temperature readings,
sampled over a finite time interval (often defined by a window function). The DFT is also used to
efficiently solve partial differential equations, and to perform other operations such as convolutions
or multiplying large integers.

PROGRAM:

%DFT%
clc;
clear all;
close all;
a=input ('Enter the input sequence');
N=length (a);
disp('Length of input sequence '); N
for k=1:N;
X(k)=0;
for i=1:N;
X(k)=X(k)+a(i)*exp((-j*pi*2/N)*((i-1)*(k-1)));

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 22


Digital Signal Processing Lab KEC 553

end;
end;
k=1:N;
disp('Output is ');
X(k)
subplot(2,1,1);
stem(k,abs(X(k)));
grid;
xlabel ('Discrete frequency (k)');
ylabel('Magnitude of X(k)');
title('Magnitude Response of DFT');
subplot(2,1,2);
stem(angle(X(k))*180/(pi));
grid;
xlabel('Discrete frequency (k)');
ylabel('Phase angle of X(k)');
title('Phase Response of X(k)');
grid;

OUTPUT:

%IDFT%
clc;
clear all;
close all;
a=input('Enter the input sequence');
disp('Length of input sequence is');
N=length(a); N
for n=1:N;
x(n)=0;
for k=1:N;
x(n)=x(n)+a(k)*exp((j*pi*2*(n-1)*(k-1)/N));
end;
end;
n=1:N;
x=1/N*x(n);
disp('Output is');

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 23


Digital Signal Processing Lab KEC 553

x(n)
stem(n,abs(x));
grid;
xlabel('Discrete time (n)');
ylabel('Magnitude of x(n)');
title('Magnitude Response of the IDFT');
grid;

OUTPUT:

RESULT:
DFT and IDFT are studied successfully with the help of MATLAB.

VIVA QUESTIONS:
1. Define Symmetric and Anti-Symmetric Signals?
2. Define Continuous and Discrete Time Signals?
3. What are the Different types of representation of discrete time signals?
4. What are the Different types of Operation performed on signals?
5. Define DFT.How DFT can be calculated in matrix form?
6. How can you plot the magnitude response of DFT and IDFT using MATLAB?
7. Which MATLAB function plots the discrete graph in the software?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 24


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-6

OBJECTIVE:
Verify Linear Convolution of two sequences using FFT.

EQUIPMENT REQUIRED:
Hardware required Software Required
PC MATLAB R2017a

THEORY:
Linear convolution using FFT:

Compute the output of a linear filter described by impulse response h(n)= {1,2,3,2,1} and input
x(n)= {1,1,1,1} using FFT algorithm.
The no of samples contained in x(n) and h(n) are M=5 and L=4. The number of samples contained
in y(n) are N=M+L-1=8, where y(n)=x(n)*h(n).Here, we will perform linear convolution through
circular convolution using FFT algorithm.

Step-1: Obtain the N-point DFTs of the sequences x (n) and h (h):
x(n) →X(k)
h (n) → H (k)

Step-2: Multiply the two sequences X (k) and H (k):


Y (k) → X (k)*H (k) ,for k=0,1,2,...,N-1

Step-3: Obtain N-point IDFT of the sequence Y(k),to yield the final output y(n)
Y (k) → y (n), for n=0,1,2,.....,N-1

PROGRAM:
%Verify Linear Convolution of two sequences using FFT
clc;
close all;
x=[1 1 1 1]; %No of samples in first sequence (M)
h=[1 2 3 2 1]; %No of samples in first sequence (L)
N=8; %Total no of samples in output sequence(N=M+L-1)
n=0:N-1;
%Linear convolution through circular convolution using FFT algorithm
X8f=fft(x,8); %DFT of sequence first sequence=X(k)
% fft(X,N) is the N-point fft, padded with zeros if X has less than N points

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 25


Digital Signal Processing Lab KEC 553

H8f=fft(h,8); %DFT of sequence second sequence=H(k)


Y8f=X8f.*H8f; %DFT of output sequence=Y(k)
y=ifft(Y8f,8) %IDFT of Y(k)=y(n)
stem(n,y)
xlabel('n---->')
ylabel('y---->')
title('Linear Convoluted Sequence')
grid on;

OUTPUT:

RESULT
Linear Convolution of two sequences using FFT with the help of MATLAB is verified.

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 linear convolution can be used to calculate the DFT of a signal?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 26


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-7

OBJECTIVE:
Verify Circular Convolution of two sequences using FFT.

EQUIPMENT REQUIRED:
Hardware required Software Required
PC MATLAB R2017a

THEORY:
Circular-convolution using FFT:

Step-1: Obtain the N-point DFTs of the sequences x (n) and h (h):
x(n) →X(k)
h (n) → H (k)

Step-2: Multiply the two sequences X (k) and H (k):


Y (k) → X (k)*H (k) ,for k=0,1,2,...,N-1

Step-3: Obtain N-point IDFT of the sequence Y(k),to yield the final output y(n)
Y (k) → y (n), for n=0,1,2,.....,N-1

PROGRAM:
clc;
close all;
x=input('Enter x(n):\n');
h=input('Enter h(n):\n');
m=length(x); %length of sequence x(n)
n=length(h); %length of sequence h(n)
N=max(m,n); %length of output sequence y(n) %For equating both sequence length
x=[x,zeros(1,N-m)];
h=[h,zeros(1,N-n)];
n=0:N-1
X=fft(x); %DFT of sequence x(n)
H=fft(h); %DFT of sequence h(n)
%performing element-wise multiplication
Y=X.*H; %DFT of output sequence y(n)
y=ifft(Y); %IDFT of Y(k)
subplot(3,1,1)

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 27


Digital Signal Processing Lab KEC 553

disp('First Sequence x(n) is:')


disp(x)
stem(n,x)
xlabel('n')
ylabel('x(n)')
title('First Sequence')
grid on;
subplot(3,1,2)
disp('Second Sequence h(n) is:')
disp(h)
stem(n,h)
xlabel('n')
ylabel('h(n)')
title('Second Sequence')
grid on;
subplot(3,1,3)
disp('Convoluted Sequence Y(n) is:')
disp(y)
stem(n,y)
xlabel('n')
ylabel('Y(n)')
title('Circular Convoluted Sequence')
grid on;

OUTPUT:

RESULT
Circular Convolution of two sequences using FFT with the help of MATLAB is verified.

VIVA QUESTIONS:
1. What is the difference between linear and circular convolution? Explain
2. What is the formula to calculate the length of circularly convoluted sequence?
3. How can we relate circular convolution and DFT?
4. Calculate circular convolution of two sequences using DFT.
5. Calculate circular convolution of two sequences of different length using linear convolution

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 28


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-8

OBJECTIVE

To verify FFT as sample interpolator.

EQUIPMENT REQUIRED:

Hardware required Software Required


PC MATLAB R2017a

THEORY:

To Interpolate and visualize 1-D data using the FFT method, The following steps are to be taken

1. Generate some sample points in the interval for the function.


2. Use a spacing interval dx to ensure the data is evenly spaced. Plot the sample points.
3. Use FFT interpolation to find the function value at 200 query points.
4. Calculate the spacing of the interpolated data from the spacing of the sample points with
dy = dx*length(x)/N, where N is the number of interpolation points. Truncate the data in
y to match the sampling density of x2.
5. Plot the results.

PROGRAM:
clc;
clear all;
close all;
dx = 3*pi/30;
x = 0:dx:3*pi;
f = cos(x);
plot(x,f,'o')
N = 100;
y = interpft(f,N);
dy = dx*length(x)/N;
x2 = 0:dy:3*pi;
y = y(1:length(x2));
hold on
plot(x2,y,'.')
title('FFT Interpolation of Periodic Function')

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 29


Digital Signal Processing Lab KEC 553

OUTPUT: -

RESULT: -FFT as sample interpolator is verified successfully using MATLAB.

VIVAQUESTIONS:
1. How is FFT able to compute DFT efficiently?
2. What are the different algorithms to calculate FFT?
3. How can we calculate magnitude and phase response of FFT using MATLAB?
4. What is the predefined function for FFT in MATLAB?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 30


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-9
OBJECTIVE:
To implement Tone Generation.

EQUIPMENT REQUIRED:

Hardware Required Software Required


PC MATLAB R2017a

THEORY:

Dual Tone Multi-Frequency or DTMF is a method for instructing a telephone switching system of
the telephone number to be dialled, or to issue commands to switching systems or related telephony
equipment. The DTMF dialling system traces its roots to a technique AT&T developed in the
1950s called MF (Multi-Frequency) which was deployed within the AT&T telephone network to
direct calls between switching facilities using in-band signalling. DTMF signalling has many
applications such as telephone dialling, data entry, credit checking, and voice mail system control.
A DTMF signal Consists of two superimposed sinusoidal waveforms with frequencies chosen from
a set of eight standardized frequencies. These frequencies should be generated and detected
according to the CCITT Recommendation. The DTMF system uses eight different frequency
signals transmitted in pairs to represent sixteen different numbers, symbols and letters.

DTMF GENERATOR
DTMF signalling uses two tones to represent each key on the touch pad. There are 12 distinct
tones. When any key is pressed the tone of the column and the tone of the row are generated. As an
example, pressing the '5' button generates the tones 770 Hz and 1336 Hz. In this example, use the
number 10 to represent the '*' key and 11 to represent the '#' key.The frequencies were chosen to
avoid harmonics: no frequency is a multiple of another, the difference between any two frequencies
does not equal any of the frequencies, and the sum of any two frequencies does not equal any of the
frequencies.
The frequencies of the tones are as follows:

1209 Hz 1336 Hz 1477 Hz


697 Hz 1 2 3
770 Hz 4 5 6
852 Hz 7 8 9
941 Hz * 0 #

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 31


Digital Signal Processing Lab KEC 553

DTMF RECEIVER
At the receiver the tone frequencies are detected, and the number decoded. The DFT algorithm can
be used to detect frequencies, but since there are only 7 frequency components (4 low frequencies
and 3 high frequencies), a more efficient method is the Goertzel algorithm. This method detects the
frequency components by passing the received signal through 7 bandpass filters. The filter
bandwidths are adjustable as a percentage of the center frequency by adjusting the bandwidth
parameter on the DTMF Receiver block mask.

SIMULATION USING MATLAB


Run the following command by entering it in the MATLAB Command Window

dspdtmf
When the simulation is run, the spectrogram of the received tone will be constructed. If the version
of the model designed for audio hardware is used, the received tone is played through the system
soundcard. The detected dialed numbers will be shown on the numeric display scope. The
following parameters can be adjusted:

1) Frequency bias for each tone (from the DTMF Generator mask dialog)
2) Channel noise power and signal gain (from the Channel mask dialog)
3) Receiver bandpass filter frequency bandwidth (from the DTMF Receiver mask dialog)

Fig 9.1: DTMF Generator and Receiver Simulink model

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 32


Digital Signal Processing Lab KEC 553

OUTPUT:

Fig 9.2: Spectrum Analyzer output waveform

RESULT:
The DTMF generator and receiver has been successfully implemented using MATLAB Simulink.

VIVAQUESTIONS:
1. How keystrokes from the telephone keypad are translated into dual tone signals over the
audio link?
2. How many distinct tones are there in the DTMF?
3. How can you obtain various blocks used in DTMF generator and receiver in the simulink?
Name them.
4. What is a Goertzel Algorithm?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 33


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-10

OBJECTIVE:
To implement floating point arithmetic.

EQUIPMENT REQUIRED:

Hardware Required Software Required


PC MATLAB R2017a

THEORY:

MATLAB represents floating-point numbers in either double-precision or single-precision format.


The default is double precision, but any number can be made single precision with a simple
conversion function.

Double-Precision Floating Point


MATLAB constructs the double-precision (or double) data type according to IEEE Standard 754
for double precision. Any value stored as a double requires 64 bits, formatted as shown in the table
below:

Bits Usage
63 Sign (0 = positive, 1 = negative)
62 to 52 Exponent, biased by 1023
51 to 0 Fraction f of the number 1.f

Single-Precision Floating Point


MATLAB constructs the single-precision (or single) data type according to IEEE Standard 754 for
single precision. Any value stored as a single requires 32 bits, formatted as shown in the table
below:
Bits Usage
31 Sign (0 = positive, 1 = negative)
30 to 23 Exponent, biased by 127
22 to 0 Fraction f of the number 1.f

Because MATLAB stores numbers of type single using 32 bits, they require less memory than
numbers of type double, which use 64 bits. However, because they are stored with fewer bits,
numbers of type single are represented to less precision than numbers of type double.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 34


Digital Signal Processing Lab KEC 553

PROGRAMS
Creating Floating-Point Data
Use double-precision to store values greater than approximately 3.4 x 1038 or less than
approximately -3.4 x 1038. For numbers that lie between these two limits, either double- or single-
precision can be used but single requires less memory.

Creating Double-Precision Data


Because the default numeric type for MATLAB is double, a double with a simple assignment
statement can be created:

x = 25.783;

The whos function shows that MATLAB has created a 1-by-1 array of type double for the value
you just stored in x:

whos x
Name Size Bytes Class
x 1x1 8 double

Use isfloat if it is to be verified that x is a floating-point number. This function returns logical 1
(true) if the input is a floating-point number, and logical 0 (false) otherwise:

isfloat(x)
ans = logical1

Other numeric data can be converted, characters or strings, and logical data to double precision
using the MATLAB function, double. This example converts a signed integer to double-precision
floating point:

y = int64(-589324077574); % Create a 64-bit integer


x = double(y) % Convert to double
x = -5.8932e+11

Creating Single-Precision Data


Because MATLAB stores numeric data as a double by default, to use the single conversion
function to create a single-precision number:
x = single (25.783);
Whose function returns the attributes of variable x in a structure. The bytes field of this structure
shows that when x is stored as a single, it requires just 4 bytes compared with the 8 bytes to store it
as a double:

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 35


Digital Signal Processing Lab KEC 553

xAttrib = whos('x');
xAttrib.bytes
ans =4

Other numeric data can be converted, characters or strings, and logical data to single precision
using the single function. This example converts a signed integer to single-precision floating point:

y = int64(-589324077574); % Create a 64-bit integer


x = single(y) % Convert to single
x =single-5.8932e+11

Arithmetic Operations on Floating-Point Numbers


Double-Precision Operations
Basic arithmetic operations can be performed with double and any of the following other classes.
When one or more operands is an integer (scalar or array), the double operand must be a scalar.The
result is of type double, except where noted otherwise:

1) single — The result is of type single


2) double
3) int* or uint* — The result has the same data type as the integer operand
4) char
5) logical

This example performs arithmetic on data of types char and double. The result is of type double:

c = 'uppercase' - 32;
class(c)
ans =double
char(c)
ans = UPPERCASE

Single-Precision Operations
Basic arithmetic operations can be performed with single and any of the following other classes.
The result is always single:
1) single
2) double
3) char
4) logical

In this example, 7.5 defaults to type double, and the result is of type single:

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 36


Digital Signal Processing Lab KEC 553

x = single([1.32 3.47 5.28]) .* 7.5;


class(x)
ans =single

Largest and Smallest Values for Floating-Point Classes


For the double and single classes, there is a largest and smallest number that you can represent with
that type.

Largest and Smallest Double-Precision Values


The MATLAB functions realmax and realmin return the maximum and minimum values that ycan
represent with the double data type:

str = 'The range for double is:\n\t%g to %g and\n\t %g to %g';


sprintf(str, -realmax, -realmin, realmin, realmax)
ans =

The range for double is:-1.79769e+308 to -2.22507e-308 and 2.22507e-308 to 1.79769e+308

Numbers larger than realmax or smaller than -realmax are assigned the values of positive and
negative infinity, respectively:

realmax + .0001e+308
ans =Inf
realmax - .0001e+308
ans =Inf

Largest and Smallest Single-Precision Values


The MATLAB functions realmax and realmin, when called with the argument 'single', return the
maximum and minimum values that you can represent with the single data type:

str = 'The range for single is:\n\t%g to %g and\n\t %g to %g';


sprintf(str, -realmax('single'), -realmin('single'), ...
realmin('single'), realmax('single'))
ans =the range for single is:
-3.40282e+38 to -1.17549e-38 and
1.17549e-38 to 3.40282e+38
Numbers larger than realmax('single') or smaller than -realmax('single') are assigned the values of
positive and negative infinity, respectively:

realmax('single') + .0001e+038
ans =singleInf

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 37


Digital Signal Processing Lab KEC 553

-realmax('single') - .0001e+038
ans =singleInf

Accuracy of Floating-Point Data


If the result of a floating-point arithmetic computation is not as precise as expected, it is likely
caused by the limitations of the computer's hardware. Probably, the result was a little less exact
because the hardware had insufficient bits to represent the result with perfect accuracy; therefore, it
truncated the resulting value.

Double-Precision Accuracy
Because there are only a finite number of double-precision numbers, that cannot represent all
numbers in double-precision storage. On any computer, there is a small gap between each double-
precision number and the next larger double-precision number. The size of this gap can be
determined, which limits the precision of your results, using the eps function. For example, to find
the distance between 5 and the next larger double-precision number, enter

format long
eps(5)
ans = 8.881784197001252e-16

This tells that there are no double-precision numbers between 5 and 5 + eps(5). If a double-
precision computation returns the answer 5, the result is only accurate to within eps(5).
The value of eps(x) depends on x. This example shows that, as x gets larger, so does eps(x):
eps(50)
ans = 7.105427357601002e-15

If eps is entered with no input argument, MATLAB returns the value of eps(1), the distance
from 1 to the next larger double-precision number.

Single-Precision Accuracy
Similarly, there are gaps between any two single-precision numbers. If x has
type single, eps(x) returns the distance between x and the next larger single-precision number. For
example,
x = single(5);
eps(x)
returns
ans =single4.7684e-07
Note that this result is larger than eps(5). Because there are fewer single-precision numbers than
double-precision numbers, the gaps between the single-precision numbers are larger than the gaps
between double-precision numbers. This means that results in single-precision arithmetic are less
precise than in double-precision arithmetic.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 38


Digital Signal Processing Lab KEC 553

For a number x of type double, eps(single(x)) gives an upper bound for the amount that x is
rounded when conversion is done from it from double to single. For example, when conversion is
done from the double-precision number 3.14 to single, it is rounded by

double (single(3.14) - 3.14)


ans =1.0490e-07

The amount that 3.14 is rounded is less than

eps(single(3.14))
ans =single2.3842e-07

Avoiding Common Problems with Floating-Point Arithmetic


Almost all operations in MATLAB are performed in double-precision arithmetic conforming to the
IEEE standard 754. Because computers only represent numbers to a finite precision (double
precision calls for 52 mantissa bits), computations sometimes yield mathematically non-intuitive
results. It is important to note that these results are not bugs in MATLAB.

Use the following programs to help identify these cases.

PROGRAM 1: Round-Off or What You Get Is Not What You Expect


The decimal number 4/3 is not exactly representable as a binary fraction. For this reason, the
following calculation does not give zero, but rather reveals the quantity eps.

e = 1 - 3*(4/3 - 1)
e = 2.2204e-16
Similarly, 0.1 is not exactly representable as a binary number. Thus, you get the following
nonintuitive behavior:
a = 0.0;
for i = 1:10
a = a + 0.1;
end
a == 1
ans = logical0
Note that the order of operations can matter in the computation:
b = 1e-16 + 1 - 1e-16;
c = 1e-16 - 1e-16 + 1;
b == c
ans =logical0
There are gaps between floating-point numbers. As the numbers get larger, so do the gaps, as
evidenced by:

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 39


Digital Signal Processing Lab KEC 553

(2^53 + 1) - 2^53
ans =0
Since pi is not really π, sin(pi) is not exactly zero:
sin(pi)
ans =1.224646799147353e-16

PROGRAM 2: Catastrophic Cancellation


When subtractions are performed with nearly equal operands, sometimes cancellation can occur
unexpectedly. The following is an example of a cancellation caused by swamping (loss of precision
that makes the addition insignificant).

sqrt(1e-16 + 1) - 1
ans =0

Some functions in MATLAB, such as expm1 and log1p, may be used to compensate for the effects
of catastrophic cancellation.

PROGRAM 3: Floating-Point Operations and Linear Algebra


Round-off, cancellation, and other traits of floating-point arithmetic combine to produce startling
computations when solving the problems of linear algebra. MATLAB warns that the following
matrix A is ill-conditioned, and therefore the system Ax = b may be sensitive to small
perturbations:
A = diag([2 eps]);
b = [2; eps];
y = A\b;
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.110223e-16.

RESULT:
Floating point arithmetic is implemented successfully using MATLAB.

VIVAQUESTIONS
1. What is double precision floating point arithmetic?
2. What is single precision floating point arithmetic?
3. How can we use whos function to create double precision and single precision data?
4. What are the MATLAB functions to perform arithmetic operations on double precision data?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 40


Digital Signal Processing Lab KEC 553

EXPERIMENT NO.-11
OBJECTIVE:
To study about DSP Processors and architecture ofTMS320C6713 DSP processor.

INTRODUCTION TO DSP PROCESSORS:


A signal can be defined as a function that conveys information, generally about the state or
behaviour 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 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
- Dual operand fetch
- Zero overhead loop
- Circular buffering

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 41


Digital Signal Processing Lab KEC 553

The basic features of a DSP Processor are:

Feature Use
Most DSP algorithms, including filtering, transforms, etc.
Fast-Multiply accumulate
are multiplication- intensive
Many data-intensive DSP operations require reading a
Multiple-access memory
program instruction and multiple data items
Efficient handling of data arrays and first-in, first-out
Specialized addressing modes
buffers in memory
Efficient control of loops for many iterative DSP algorithms.
Specialized program control
Fast interrupt handling for frequent I/O
On-chip peripherals like A/D converters allow for small low
On-chip peripherals and I/O
cost system designs. Similarly, I/O

Digital signal processors are used for a wide range of applications, from communications and
control to speech and image processing. They are found in cellular phones, fax/modems, disk
drives, radios, printers, hearing aids, MP3 players, HDTV, digital cameras, and so on. Specialized
(particularly in terms of their on-board peripherals) DSPs are used in electric motor drives and a
range of associated automotive and industrial applications. Overall, DSPs are concerned primarily
with real-time signal processing. Real-time processing means that the processing must keep pace
with some external event; whereas non real-time processing has no such timing constraint. The
external event to keep pace with is usually the analog input. While analog-based systems with
discrete electronic components including resistors and capacitors are sensitive to temperature
changes, DSP-based systems are less affected by environmental conditions such as temperature.
DSPs enjoy the major advantages of microprocessors. They are easy to use, flexible, and
economical.

Table 11.1: Main Texas Instruments (TI) and Analog Devices (ADI) DSP families, together with
their typical use and performance

Manufacturer Family Typical use and performance

TMS320C2x Digital signal controllers


TI TMS320C5x Power efficient
TMS320C6x High performance
SHARC Medium performance. First ADI family (now three generations)
ADI TigerSHARC High performance for multi-processor systems
Blackfin High performance and low power

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 42


Digital Signal Processing Lab KEC 553

The hardware experiments in this DSP lab are carried out on the Texas Instruments TMS320C6713
DSP Starter Kit (DSK), based on the TMS320C6713 floating point DSP running at 225MHz. The
basic clock cycle instruction time is 1/(225 MHz) = 4.44 nanoseconds. During each clock cycle, up
to eight instructions can be carried out in parallel, achieving up to 8 × 225 = 1800 million
instructions per second (MIPS).

The C6713 processor has 256KB of internal memory and can potentially address 4GB of external
memory. The DSK board includes a 16MB SDRAM memory and a 512KB Flash ROM. It has an
on-board 16-bit audio stereo codec (the Texas Instruments AIC23B) that serves both as an A/D and
a D/A converter. There are four 3.5 mm audio jacks for microphone and stereo line input, and
speaker and head-phone outputs. The AIC23 codec can be programmed to sample audio inputs at
the following sampling rates:fs = 8, 16, 24, 32, 44.1, 48, 96 kHz.

The ADC part of the codec is implemented as a multi-bit third-order noise-shaping delta-sigma
converter that allows a variety of oversampling ratios that can realize the above choices of fs. The
corresponding oversampling decimation filters act as anti-aliasing pre-filters that limit the spectrum
of the input analog signals effectively to the Nyquist interval [−fs/2, fs/2]. The DAC part is
similarly implemented as a multi-bit second-order noise-shaping delta-sigma converter whose
oversampling interpolation filters act as almost ideal reconstruction filters with the Nyquist interval
as their pass band.

The DSK also has four user-programmable DIP (Dual In-line Package) switches and four LEDs
that can be used to control and monitor programs running on the DSP.All features of the DSK are
managed by the Code Composer Studio (CCS), which is a complete integrated development
environment (IDE) that includes an optimizing C/C++ compiler, assembler, linker, debugger, and
program loader.

Fig.11.1.: Block diagram of TMS 320C6713

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 43


Digital Signal Processing Lab KEC 553

The CCS communicates with the DSK via a USB connection to a PC. In addition to facilitating all
programming aspects of the C6713 DSP, the CCS can also read signals stored on the DSP’s
memory, or the SDRAM, and plot them in the time or frequency domains. The following block
diagram depicts the overall operations involved in all the hardware experiments in the DSP lab.
Processing is interrupt-driven at the sampling rate fs, as explained below.

The AIC23 codec is configured (through CCS) to operate at one of the above sampling rates f s.
Each collected sample is converted to a 16-bit two’s complement integer (a short data type in C).
The codec samples the audio input in stereo, that is, it collects two samples for the left and right
channels. At each sampling instant, the codec combines the two 16-bit left/right samples into a
single 32-bit unsigned integer word (an unsigned int, or Uint32 data type in C), and ships it over
to a 32-bit receive-register of the multichannel buffered serial port (McBSP) of the C6713
processor, and then issues an interrupt to the processor

Upon receiving the interrupt, the processor executes an interrupt service routine (ISR) that
implements desired sample processing algorithm programmed with the CCS (e.g. filtering, audio
effects, etc.).During the ISR, the following actions take place: the 32-bit input sample (denoted by
x in the diagram) is read from the McBSP, and sent into the sample processing algorithm that
computes the corresponding 32-bit output word (denoted by y), which is then written back into a
32-bit transmit-register of the McBSP, from where it is transferred to the codec and reconstructed
into analog format, and finally the ISR returns from interrupt, and the processor begins waiting for
the next interrupt, which will come at the next sampling instant.

ARCHITECTURE OF TMS320C6713 DSP PROCESSOR:

The C6x notation is used to designate a member of the Texas Instruments (TI) TMS320C6000
family of digital signal processors. The architecture of the C6x digital signal processor is very well
suited to numerically intensive calculations. Based on a very-long-instruction-word (VLIW)
architecture, the C6x is TI’s most powerful processor family.

The architectural structure of the TMS320C67xx DSP comprises of the central processing unit
(CPU), memory, and on-chip peripherals. The C67xx 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.

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 44


Digital Signal Processing Lab KEC 553

Fig.11.2:Architecture of TMS 320C6713

The C67xx DSP can generate up to two data-memory addresses per cycle using the two auxiliary
register arithmetic units (ARAU0 and ARAU1). The PB can carry data operands stored in program
space (for instance, a coefficient table) to the multiplier and adder for multiply/accumulate
operations or to a destination in data space for data move instructions (MVPD and READA). This

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 45


Digital Signal Processing Lab KEC 553

capability, in conjunction with the feature of dual-operand read, supports the execution of single-
cycle, 3-operand instructions such as the FIRS instruction. The C67xx DSP also has an on-chip
bidirectional bus for accessing on-chip peripherals. This bus is connected to DB and EB through
the bus exchanger in the CPU interface. Accesses that use this bus can require two or more cycles
for reads and writes, depending on the peripheral’s structure.

Central Processing Unit (CPU)


The CPU is common to all C67xx devices. The C67xx 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 C67xx 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


 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.

Accumulators
Accumulators A and B store the output from the ALU or the multiplier/adder block. They can also
provide a second input to the ALU; accumulator A can be an input to the multiplier/adder. Each
accumulator is divided into three parts:

 Guard bits (bits 39–32)


 High-order word (bits 31–16)
 Low-order word (bits 15–0)

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 46


Digital Signal Processing Lab KEC 553

Instructions are provided for storing the guard bits, for storing the high- and the low-order
accumulator words in data memory, and for transferring 32-bit accumulator words in or out of data
memory. Also, either of the accumulators can be used as temporary storage for the other.

Barrel Shifter
The C67xx DSP barrel shifter has a 40-bit input connected to the accumulators or to data memory
(using CB or DB), and a 40-bit output connected to the ALU or to data memory (using EB). The
barrel shifter can produce a left shift of 0 to 31 bits and a right shift of 0 to 16 bits on the input data.
The shift requirements are defined in the shift count field of the instruction, the shift count field
(ASM) of status register ST1, or in temporary register T (when it is designated as a shift count
register).The barrel shifter and the exponent encoder normalize the values in an accumulator in a
single cycle. The LSBs of the output are filled with 0s, and the MSBs can be either zero filled or
sign extended, depending on the state of the sign-extension mode bit (SXM) in ST1. Additional
shift capabilities enable the processor to perform numerical scaling, bit extraction, extended
arithmetic, and overflow prevention operations.

Fig. 11.3: ALU unit

Multiplier/Adder Unit
The multiplier/adder unit performs 17_17-bit 2’s-complement multiplication with a 40-bit addition
in a single instruction cycle. The multiplier/adder block consists of several elements: a multiplier,
an adder, signed/unsigned input control logic, fractional control logic, a zero detector, a rounder
(2’s complement), overflow/saturation logic, and a 16-bit temporary storage register (T). The
multiplier has two inputs: one input is selected from T, a data-memory operand, or accumulator A;
the other is selected from program memory, data memory, accumulator A, or an immediate value.
The fast, on-chip multiplier allows the C67xx DSP to perform operations efficiently such as

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 47


Digital Signal Processing Lab KEC 553

convolution, correlation, and filtering. In addition, the multiplier and ALU together execute
multiply/accumulate (MAC) computations and ALU operations in parallel in a single instruction
cycle. This function is used in determining the Euclidian distance and in implementing symmetrical
and LMS filters, which are required for complex DSP algorithms.

Fig. 11.4: Multiplier/Adder Unit

These are the some of the important parts of the processor and you are instructed to go through the
detailed architecture once which helps you in developing the optimized code for the required
application.

C6713 DSK FEATURES:


1. A Texas InstrumentsTMS320C6713 DSP operatingat225 MHz
2. AnAIC23 stereo codec
3. 16 Mbytes of synchronous DRAM
4. 512 Kbytes of non-volatile Flash memory (256 Kbytes usable in default configuration)
5. 4 user accessible LEDs and DIP switches
6. Software board configuration through registers implemented in CPLD (Complex
Programmable Logic Device)
7. Configurable boot options
8. JTAG (Joint Test Action Group) emulation through on-board JTAG emulator with USB host
interface or external emulator
9. Single voltage power supply(+5V)

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 48


Digital Signal Processing Lab KEC 553

Fig. 11.5: TMS320C6713 DSP Starter Kit (DSK)

Fig. 11.6: Block diagram of TMS320C6713 DSP Starter Kit (DSK)

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 49


Digital Signal Processing Lab KEC 553

Fig. 11.7: TMS320C6713 DSK codec interface

RESULT:
The architecture of DSP processor-TMS 320C67xx is studied successfully.

VIVA QUESTIONS
1. Define signal and signal processing.
2. Differentiate digital and analog signals?
3. How DSP processors differ from conventional processors?
4. Expand the abbreviation TMS320C67xx.
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?

Department of Electronics & Communication Engineering, NIET; Greater Noida Page 50

You might also like