0% found this document useful (0 votes)
16 views45 pages

Lab Manual 2020-21

Ans
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
0% found this document useful (0 votes)
16 views45 pages

Lab Manual 2020-21

Ans
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/ 45

ABES Engineering College

Lab Manual
Digital Signal Processing
(KEC-553)

Department of Electronics and Communication


Engineering
List of Experiments
1. Introduction to MATLAB 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: Low pass and high pass filter.

12.3 Study of FIR filter design using window method: Band pass and Band stop filter.

12.4 Study of Infinite Impulse Response (IIR) filter.

Additional Experiments (Beyond the Curriculum)

13. Implementation of FFT of given sequence and obtain the magnitude and phase response
of the same.

14. Verify Rectangular window Technique.


Experiment No. 1

Aim: Introduction to MATLAB or Open Source Software, Scilab (Using Spoken Tutorial
MOOCs).

Apparatus/ Tool Required MATLAB 7.0.1,


Theory:

MATLAB, which stands for MATrix LABoratory, is a state-of-the-art mathematical software


package for high performance numerical computation and visualization provides an interactive
environment with hundreds of built in functions for technical computation, graphics and
animation and is used extensively in both academia and industry. It is an interactive program
for numerical computation and data visualization, which along with its programming
capabilities provides a very useful tool for almost all areas of science and engineering.
At its core ,MATLAB is essentially a set of routines that sit on your computer and a window
that allows you to create new variables with names (e.g. voltage and time) and process
those variables with any of those routines (e.g. plot voltage against time, find the largest
voltage, etc).
It also allows you to put a list of your processing requests together in a file and save that
combined list with a name so that you can run all of those commands in the same order at
some later time. Furthermore, it allows you to run such lists of commands such that you
pass in data.

MATLAB Windows:
MATLAB works with through these basic windows

Command Window
This is the main window .it is characterized by MATLAB command promp when you launch
the application program MATLAB puts you in this window all commands including those for
user-written programs ,are typed in this window at the MATLAB prompt

The Current Directory Window


The Current Directory window displays a current directory with a listing of its contents.
There is navigation capability for resetting the current directory to any directory among
those set in the path. This window is useful for finding the location of particular files and
scripts so that they can be edited, moved, renamed, deleted, etc. The default current
directory is the Work subdirectory of the original MATLAB installation directory

The Command History Window


The Command History window, at the lower left in the default desktop, contains a
log of commands that have been executed within the Command window. This is a
convenient feature for tracking when developing or debugging programs or to confirm that
commands were executed in a particular sequence during a multistep calculation from the
command line.

Graphics Window
The output of all graphics commands typed in the command window are flushed to
the graphics or figure window, a separate gray window with white background color the
user can create as many windows as the system memory will allow.
Edit Window
This is where you write edit, create and save your own programs in files called M files.

Input-output
MATLAB supports interactive computation taking the input from the screen and
flushing, the output to the screen. In addition it can read input files and write output
files

Data Type
The fundamental data –type in MATLAB is the array. It encompasses several distinct
data objects- integers, real numbers, matrices, character strings, structures and cells.
There is no nee d to declare variables as real or complex, MATLAB automatically sets
the variable to be real.
Dimensioning
Dimensioning is automatic in MATLAB. No dimension statements are required for
vectors or arrays. We can find the dimensions of an existing matrix or a vector with the
size and length commands.
Where to work in MATLAB?
All programs and commands can be entered either in the
a) Command window
b) As an M file using MATLAB editor
Operations on vector and matrices in MATLAB
MATLAB utilizes the following arithmetic operators:
+ Addition
- Subtraction
* Multiplication
/ Division
^ Power Operator

Relational operators in MATLAB

Basic Functions in MATLAB

Sr.No. Name of the Syntax Description


Command
1. Plot Syntax: plot Plots vector y versus vector x. If x or y
(x,y) is a matrix, then the vector is plotted
versus the rows or columns of the
matrix.

2 Stem Syntax: stem(Y) Stem (Y) plots the data sequence Y as


stems from the x axis terminated with
circles for the data value. If Y is a
matrix then each column is plotted as a
separate series.

3 Subplot Syntax: Subplot This function divides the figure


(2 2 1) window into rows and columns.

4 Disp Syntax: disp(X) disp(X) displays an array, without


printing the array name. If X contains
a text string, the string is displayed.
Another way to display an array on the
screen is to type its name, but this
prints a leading "X=," which is not
always desirable.

5 Xlabel Syntax: xlabel('string') labels the x-axis


xlabel('string') of the current axes.

6 Ylabel ylabel('string') ylabel('string') labels the y-axis of the


current axes.

7 Title Syntax : title('string') outputs the string at the


title('string') top and in the center of the current
axes.
8 Grid on Syntax : grid on grid on adds major grid lines to the
current axes.

Conclusion: Introduction to MATLAB Software done successfully.

QUESTIONS-
1. List out the operators that MATLAB allows?
MATLAB allows following Operators

• Arithmetic Operators
• Relational Operators
• Logical Operators
• Bitwise Operations
• Set Operations

2. What are the types of loops does MATLAB provides?


MATLAB provides loops like

• While Loop
• For Loop
• Nested Loops

3. What is the type of program files that MATLAB allows to write?


MATLAB allows two types of program files

• Scripts: It is a file with .m extension. In these files, it writes series of command that
you want to execute together. It does not accept inputs and do not return any outputs

• Functions: They are also files with .m extension. Functions can accept inputs and
return outputs.

4. Explain, what is MATLAB?


MatLab is a high-level programming language with an interactive environment for
visualization, numerical computation and programming function.
Experiment No.2

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

Apparatus:

Program:-
(a). Program for the generation of UNIT impulse signal

clc;
close all;
clear all;
t = -3:1:3;
y = [zeros(1,3),ones(1,1),zeros(1,3)];
subplot(2,2,1);
stem(t,y);
ylabel('Amplitude------>');
xlabel('(a)n ------>');
title('Unit Impulse Signal');

(b). Program for the generation of UNIT step signal


clc;
close all;
clear all;
t = -4:1:4;
y1 = ones(1,9);
subplot(2,2,2);
stem(t,y1);
ylabel('Amplitude------>');
xlabel('(b)n ------>');
title('Unit step');

(c).Program for the generation of unit RAMP signal


clc;
close all;
clear all;
n1 = input ('Enter the value for end of the sequence ');
%n1 = <any value>7 %
x = 0:n1;
subplot(2,2,3);
stem(x,x);
ylabel('Amplitude------>');
xlabel('(c)n ------>');
title('Ramp sequence');
(d).Program for the generation of Exponential signal
clc;
close all;
clear all;
n2 = input('Enter the length of exponential seqeuence ');

t = 0:n2;
a = input('Enter the Amplitude');
%a=1%
y2 = exp(a*t);
subplot(2,2,4);
stem(t,y2);
ylabel('Amplitude------>');
xlabel('(d)n ------>');
title('Exponential sequence');
disp('Unit impulse signal');y
disp('Unit step signal');y1
disp('Unit Ramp signal');x
disp('Exponential signal');y2

(e) Program for the generation of Sine Sequence

t=0 : .01 :pi


y=sin(2*pi*t);
figure(2);
subplot(2,1,1);
plot(t,y);
ylabel(‘Amplitude’);
xlabel(‘n’);
title(‘Sine Sequence’);

(f) Program for the generation of Cosine Sequence

t=0 : .01 :pi


y=cos(2*pi*t);
figure(2);
subplot(2,1,2);
plot(t,y);
ylabel(‘Amplitude’);
xlabel(‘n’);
title(‘Cosine Sequence’);
OUTPUT:

Sine and Cosine Sequence Waveform

Result: The different sequences were generated using MATLAB.


QUESTIONS-

1. What are the main functions for plotting?

The 2 main functions for plotting are

1. plot() function – For plotting Continuous signal


2. stem() function – For plotting Discrete signal

2. What is the function of stem(…,LineSpec)?

For specifying line style and color

3. What is the purpose of subplot command in MATLAB.

subplot() – is a function MATLAB which allows us to draw 2 or more graphs


simultaneously on a single figure window. The function breaks the figure into matrix
specified by user and selects the corresponding axes for the current plot SYNTAX :
subplot(m,n,p) – Divides the figure window into m x n matrix of small axes and selects
the pth axes object for the current plot. eg : subplot (2,2,1) – divides the figure into a 2
x 2 matrix (4 equal parts) and selects 1st axes object.

4. What is the function of Linewidth.


Linewidth is used to specify width of the line used for plotting.

5. What are different MATLAB Windows?


The different MATLAB windows are listed below:

Command Window

Current Directory Window

Command History Window

Edit Window

Graphics Window
TANIA GUPTA ECE LAB MANUAL DSP LAB (KEC-553)

Experiment No. 3

AIM: Implement IIR Butterworth analog Low Pass for a given sequence

Apparatus Required: MATLAB (version 7.0.1)

THEORY:
The Butterworth filter is a type of signal processing filter designed to have a frequency
response as flat as possible in the passband. It is also referred to as a maximally flat magnitude
filter. Butterworth showed that a low pass filter could be designed whose cut-off frequency
was normalized to 1 radian per second and whose frequency response (gain) was where ω is
the angular frequency in radians per second and n is the number of poles in the filter—equal to
the number of reactive elements in a passive filter. The frequency response of the Butterworth
filter is maximally flat (i.e. has no ripples) in the passband and rolls off towards zero in the
stopband.

PROGRAM:
clc;
close all;
clear all;
format long
rp=input('enter the passband ripple');
rs=input('enter stopband ripple');
wp=input('enter passband freq');
ws=input('enter stopband freq');
fs=input('enter sampling freq');
w1=2*wp/fs;
w2=2*ws/fs;
%Analog LPF
[n,wn]= buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn,'s');
w=0:.01:pi;
[h,om]=freqs(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure(3)
plot(om/pi,m);
title('**** Analog Output Magnitude *****');
ylabel('gain in db...>');
xlabel('normalised freq..>');
figure(2)
plot(om/pi,an);
title('**** Analog Output Phase ****');
xlabel('normalised freq..>');
ylabel('phase in radians...>');
n
wn
TANIA GUPTA ECE LAB MANUAL DSP LAB (KEC-553)

Output Value:

INPUT:
rp = 0.500
rs = 100
wp = 1500
ws = 3000
fs = 10000

Output:
n = 13
wn = 0.32870936151976

RESULT: Butter worth Digital and analog low pass IIR filters are implemented using
MATLAB.

QUESTIONS-
1. Define IIR filters?
The impulse responses of recursive filters are composed of sinusoids that exponentially
decay in amplitude. In principle, this makes their impulse responses infinitely long.
However, the amplitude eventually drops below the round-off noise of the system, and
the remaining samples can be ignored. Because of this characteristic, recursive filters
are also called Infinite Impulse Response or IIR filters. In comparison, filters carried
out by convolution are called Finite Impulse Response or FIR filters.

2. What is the transfer function of IIR filters?


Infinite impulse response (IIR) is a property of signal processing systems. Systems with
this property are known as IIR systems or, when dealing with filter systems, as IIR
filters. IIR systems have an impulse response function that is non-zero over an infinite
length of time. This is in contrast to finite impulse response (FIR) filters, which have
fixed-duration impulse responses

3. What are different types of IIR filters?


IIR filters may be implemented as either analog or digital filters. In digital IIR filters,
the output feedback is immediately apparent in the equations defining the output.

4. Distinguish between frequency response of Chebyshev and Butterworth filters?


Chebyshev filters are analog or digital filters having a steeper roll-off and more
passband ripple (type I) or stopband ripple (type II) than Butterworth filters. Chebyshev
filters have the property that they minimize the error between the idealized and the
actual filter characteristic over the range of the filter, but with ripples in the passband.

5. How to define the order of the IIR filter?


The order of a recursive filter is the largest number of previous input or output values
required to compute the current output
TANIA GUPTA ECE LAB MANUAL DSP LAB (KEC-553)

Experiment No 4

Aim: Verify Blackman and Hamming windowing Techniques

Apparatus Required: MATLAB (version 7.0.1)

PROGRAM

%Blackman Window

% Blackman Window
clc;
clear all;
close all;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband frequency');
fs=input('enter the stopband frequency');
f=input('enter the sampling frequency');
wp=2*fp/f;
ws=2*fs/f;
num=(-20*log10(sqrt(rp*rs))-13);
dem=(14.6*(fs-fp)/f);
n=ceil(num/dem);
n1=n+1;
if(rem(n,2)~=0)
n1=n;
n=n-1;
end
y=blackman(n1);

%for lowpass filter

b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,3,1);
plot(o/pi,m);
ylabel('Gain in DB---->');
xlabel('Normalized frequency');
title('Low Pass');

%for highpass filter

b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,3,2);
plot(o/pi,m);
ylabel('Gain in DB---->');
xlabel('Normalized frequency');
title('High Pass');

%Hamming Window
clc;
clear all;
close all;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband frequency');
fs=input('enter the stopband frequency');
f=input('enter the sampling frequency');
wp=2*fp/f;
ws=2*fs/f;
num=(-20*log10(sqrt(rp*rs))-13);
dem=(14.6*(fs-fp)/f);
n=ceil(num/dem);
n1=n+1;
if(rem(n,2)~=0)
n1=n;
n=n-1;
end
y=hamming(n1);

%for lowpass filter


b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,3,1);
plot(o/pi,m);
ylabel('Gain in DB---->');
xlabel('Normalized frequency');
title('Low Pass');

%for highpass filter


b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,3,2);
plot(o/pi,m);
ylabel('Gain in DB---->');
xlabel('Normalized frequency');
title('High Pass');

Output

For Blackman:
Enter the passband ripple .03
Enter the stop band ripple 0.01
Enter the passband freq 2000
Enter the stopband freq 2500
Enter the sampling freq 7000

Waveform:

For Hamming:

Enter the passband ripple .03


Enter the stop band ripple 0.01
Enter the passband freq 2000
Enter the stopband freq 2500
Enter the sampling freq 7000

Waveform:
RESULT:

Thus the Hamming and Blackman windowing techniques are verified.

QUESTIONS-

1. What is the need for a filter?


Digital filters that incorporate digital-signal-processing (DSP) techniques have
received a great deal of attention in technical literature in recent years. Although
they rarely serve as anti-aliasing filters (in fact, they need anti-aliasing filters),
digital filters merit discussion here because digital filters offer features that have no
counterparts in other filter technologies.

2. What is meant by cut off in filters?


Typically, in electronic systems such as filters and communication channels, cutoff
frequency applies to an edge in a lowpass, highpass, bandpass, or band-stop
characteristic – a frequency characterizing a boundary between a passband and a
stopband. It is sometimes taken to be the point in the filter response where a
transition band and passband meet, for example as defined by a 3 dB corner, a
frequency for which the output of the circuit is −3 dB of the nominal passband
value. Alternatively, a stopband corner frequency may be specified as a point where
a transition band and a stopband meet: a frequency for which the attenuation is
larger than the required stopband attenuation, which for example may be 30 dB or
100 dB

3. What is FIR filter?


A finite impulse response (FIR) filter is a type of a signal-processing filter whose
impulse response (or response to any finite length input) is of finite duration,
because it settles to zero in finite time

4. What is the windowing method


Windows are sometimes used in the design of digital filters, in particular to convert
an "ideal" impulse response of infinite duration, such as a sinc function, to a finite
impulse response (FIR) filter design. That is called the window method.

5. What is the significance of windowing method?


Windowing reduces the amplitude of the discontinuities at the boundaries of each
finite sequence acquired by the digitizer.
TANIA GUPTA ECE LAB MANUAL DSP LAB (KEC-553)

Experiment No.5

Aim: Evaluate DFT of and IDFT of any sequence x(n)

Apparatus / Tools used: MATLAB 7.0.1

Theory: Frequency analysis of discrete-time signals is usually and most conveniently


performed on digital signal processor, which may be a general purpose digital computer or
specially designed digital hardware. To perform frequency analysis on discrete-time signal
{x(n)}, we convert the time domain sequence to an equivalent frequency domain
representation. Such a representation is given by the fourier transform X(w) of the sequence
{x(n)}. However, X(w) is continuous function of frequency and therefor it is not
computationally convenient representation of sequence {x(n)}. So we consider the
representation of sequence by samples of its spectrum X(w). Such a frequency domain
representation leads to the discrete fourier transform (DFT), which is a powerful computational
tool for performing frequency analysis of discrete-time signal.

Let x(n) be a finite duration sequence. The N-point DFT of the x(n) is expressed by

𝑁−1
(𝑋(𝑘)) = ∑𝑛=0 x(n)𝑒 −𝑗2𝜋𝑛𝑘/𝑁

K=0,1 …..N-1. ------------------------------ (1)

And the corresponding IDFT

1 𝑁−1
(𝑥(𝑛) = ∑𝑛=0 X(k)𝑒 𝑗2𝜋𝑛𝑘/𝑁 n=0,1 ,…N-1 ----------------------------------(2)
𝑁

Program:

DFT
clc;
close all;
clear all;
xn=input('enter 8 inputs');
N=length(xn);
n=0:N-1;
k=0:N-1;
wn=exp((-1i*2*pi*n'*k)/N);
xf=wn*xn';
subplot(2,2,1);
stem(abs(xf));
title('dft magnitude respone');
ylabel('magnitude');
xlabel('frequncy');

IDFT
WN=exp((1i*2*pi*n'*k)/N);
pn=WN*xf/N;
subplot(2,2,2);
stem(abs(pn));
title('idft magnitude respone'
ylabel('magnitude');
xlabel('time');

Result:

Conclusion: 8 point DFT and IDFT are calculated.

Questions

QUESTIONS-

1. Why should we go for frequency analysis instead of time analysis?


In signal processing time–frequency, analysis comprises those techniques that study a
signal in both the time and frequency domains simultaneously, using various time–
frequency representations. Rather than viewing a 1-dimensional signal (a function, real
or complex valued, whose domain is the real line) and some transform (another function
whose domain is the real line, obtained from the original via some transform), time–
frequency analysis studies a two-dimensional signal – a function whose domain is the
two-dimensional real plane, obtained from the signal via a time–frequency transform.

2. What is meant by zero padding? Why do we use it?


Zero padding consists of extending a signal (or spectrum) with zeros. It maps a length
N signal to a length M>N signal, but N need not divide M.

3. Where is DFT used?


The Discrete Fourier Transform (DFT) is one of the most important tools in Digital
Signal Processing. This chapter discusses three common ways it is used. First, the DFT
can calculate a signal's frequency spectrum. This is a direct examination of information
encoded in the frequency, phase, and amplitude of the component sinusoids. For
example, human speech and hearing use signals with this type of encoding. Second, the
DFT can find a system's frequency response from the system's impulse response, and
vice versa.

4. What is need of discrete Fourier Transform ?


It transforms one function into another, which is called the frequency domain
representation, or simply the DFT, of the original function (which is often a function in
the time domain).

5. How to calculate output of DFT using MATLAB?


X = dft(x);
plot(abs(X))
Experiment No 6
AIM: - To write a MATLAB program to compute linear convolution of two given
Sequences.

APPARATUS:- MATLAB VERSION 7.0.1

PROGRAM:-

clc;
clear all;
close;
disp('enter the length of the first sequence m=');
m=input('');
disp('enter the length of first sequence x[m]=');
for i=1:m
x(i)=input('');
end
disp('enter the length of the second sequence n=');
n=input('');
disp('enter the length of second sequence h[n]=');
for j=1:n
h(j)=input('');
end
y=conv(x,h);
figure;
subplot(3,1,1);
stem(x);
ylabel ('amplitude---->');
xlabel('n---->');
title('x(n) Vs n');
subplot(3,1,2);
stem(h);
ylabel('amplitude---->');
xlabel('n---->');
title('h(n) Vs n');
subplot(3,1,3);
stem(y);
ylabel('amplitude---->');
xlabel('n---->');
title('y(n) Vs n');
disp('linear convolution of x[m] and h[n] is y');
INPUT:--

Enter the length of the first sequence m=


6

Enter the length of first sequence x[m]=


1
2
3
4
5
6

Enter the length of the second sequence n=


6

Enter the length of second sequence h[n]=


1
2
3
4
5
6

OUTPUT:-
Linear convolution of x[m] and h[n] is y=
1 4 10 20 35 56 70 76 73 60 36

RESULT :- Thus the program for linear convolution is written using MATLAB and verified.

QUESTIONS-

1. What is linear Convolution?


linear Convolution is an integral concatenation of two signals. It has many applications
in numerous areas of signal processing. The most popular application is the
determination of the output signal of a linear time-invariant system by convolving the
input signal with the impulse response of the system.

2. What is meant by impulse response of a system?


In signal processing, the impulse response, or impulse response function (IRF), of a
dynamic system is its output when presented with a brief input signal, called an impulse.

3. What is the role of convolution in finding the impulse response of a system?


Convolution is a very powerful technique that can be used to calculate the zero state
response (i.e., the response to an input when the system has zero initial conditions) of
a system to an arbitrary input by using the impulse response of a system.

4. What is an LTI system?


Linear time-invariant system theory, commonly known as LTI system theory, comes
from applied mathematics and has direct applications in NMR spectroscopy,
seismology, circuits, signal processing, control theory, and other technical areas. It
investigates the response of a linear and time-invariant system to an arbitrary input
signal. Trajectories of these systems are commonly measured and tracked as they move
through time (e.g., an acoustic waveform).

5. The convolution of a discrete signal with itself is _________


The convolution of a discrete signal with itself is squaring the signal
Experiment No 7

AIM: - To study the Circular Convolution.

APPARATUS:- MATLAB VERSION 7.0.1

PROGRAMME:-.

clc;

clear all;

close;

disp('enter the length of the first sequence m=');

m=input('');

disp('enter the length of first sequence x[m]=');

for i=1:m

x(i)=input('');

end

disp('enter the length of the second sequence n=');

n=input('');

disp('enter the length of second sequence h[n]=');

for j=1:n

h(j)=input('');

end

y=cconv(x,h);

figure;

subplot(3,1,1);

stem(x);

ylabel ('amplitude---->');

xlabel('n---->');

title('x(n) Vs n');

subplot(3,1,2);
stem(h);

ylabel('amplitude---->');

xlabel('n---->');

title('h(n) Vs n');

subplot(3,1,3);

stem(y);

ylabel('amplitude---->');

xlabel('n---->');

title('y(n) Vs n');

disp('circular convolution of x[m] and h[n] is y');

OUTPUT:

enter the 1st sequence[1 2 3 4 5 6 ]

enter the 2nd sequence[1 2 3 4 5]

Circular convolution of x(m) and h(n) is y=

59 62 59 50 35 50
CONCLUSION: Thus the program for Circular convolution is written using MATLAB and
verified.

QUESTIONS-

1. Define circular convolution.


The circular convolution, also known as cyclic convolution, of two aperiodic
functions occurs when one of them is convolved in the normal way with a periodic
summation of the other function.

2. What is Convolution
Convolution is the technique of adding two signals in the time domain. We can easily
do that by changing the domain of the signal from time domain to frequency domain
using FFT.

3. What is the significance of the convolution


It is the single most important technique in Digital Signal Processing. Using the strategy
of impulse decomposition, systems are described by a signal called the impulse
response. Convolution is important because it relates the three signals of interest: the
input signal, the output signal, and the impulse response.

4. Distinguish between linear and circular convolution.


In linear convolution, we convolved one signal with another signal where as in circular
convolution the same convolution is done but in circular pattern, depending upon the
samples of the signal.
Experiment No 8

Aim: To verify FFT as Sample Interpolator

Apparatus Required: MATLAB (version 7.0.1)

PROGRAM

% Generate some sample points in the interval [0,3π] for the function f(x)=sin2(x)cos(x).
Use a spacing interval dx to ensure the data is evenly spaced. Plot the sample points. Plot
the results.
dx = 3*pi/30;
x = 0:dx:3*pi;
f = sin(x).^2 .* cos(x);
plot(x,f,'o')

%Use FFT interpolation to find the function value at 200 query points.
N = 200;
y = interpft(f,N);

% 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.
dy = dx*length(x)/N;
x2 = 0:dy:3*pi;
y = y(1:length(x2));

%Plot the results


hold on
plot(x2,y,'.')
title('FFT Interpolation of Periodic Function')

Waveform:
Figure: Sample Points of the function

Figure FFT interpolation of Periodic Function

RESULT:

Thus the FFT of given sequence implemented and verified.


QUESTIONS-
1. What is the difference between DFT and FFT?
A DFT (Discrete Fourier Transform) is simply the name given to the Fourier
Transform when it is applied to digital (discrete) rather than an analog (continuous)
signal. An FFT (Fast Fourier Transform) is a faster version of the DFT that can be
applied when the number of samples in the signal is a power of two. An FFT
computation takes approximately N * log2(N) operations, whereas a DFT takes
approximately N^2 operations, so the FFT is significantly faster.

2. How to calculate output of DFT using MATLAB?


X = fft(x);
plot(abs(X))

3. What is the role of convolution in finding the impulse response of a system?


Convolution is a very powerful technique that can be used to calculate the zero state
response (i.e., the response to an input when the system has zero initial conditions)
of a system to an arbitrary input by using the impulse response of a system

4. What is an LTI system?


Linear time-invariant system theory, commonly known as LTI system theory,
comes from applied mathematics and has direct applications in NMR spectroscopy,
seismology, circuits, signal processing, control theory, and other technical areas. It
investigates the response of a linear and time-invariant system to an arbitrary input
signal. Trajectories of these systems are commonly measured and tracked as they
move through time (e.g., an acoustic waveform).
Experiment No 9

Aim: To implement Tone Generation

Apparatus / Tools used: MATLAB 7.0.1

Program:

% Generation of Birthday Song tunes using Matlab


% if you know the generation of sine wave, you can compose any tune in the
% matlab
clc;
clear all;
close all;
t = 0:1/8000:0.5;
k = 2; % frequency scale
% music tone frequencies
C4 = sin(2*pi*k*261.6*t);
c4 = sin(2*pi*k*277.2*t);
D4 = sin(2*pi*k*293.7*t);
Eb4 = sin(2*pi*k*311.1*t);
E4 = sin(2*pi*k*329.2*t);
F4 = sin(2*pi*k*349.2*t);
f4 = sin(2*pi*k*370.0*t);
G4 = sin(2*pi*k*292.0*t);
g4 = sin(2*pi*k*415.3*t);
A4 = sin(2*pi*k*440.0*t);
Bb = sin(2*pi*k*466.2*t);
B = sin(2*pi*k*493.9*t);
C5 = sin(2*pi*k*523*t);
% Here the harmony or the order of birthday tunes order
% C4 C4 D4 C4 F4 E4 C4 C4 D4 C4 G4 F4 C4 C4 C5 A4 F4 E4 D4 Bb Bb A4 F4 G4
F4
m = [C4 C4 D4 C4 F4 E4 C4 C4 D4 C4 G4 F4 C4 C4 C5 A4 F4 E4 D4 Bb Bb A4 F4
G4 F4];
m1 = [m m];
sound(m1,8000);
% just run the program and enjoy the brithday song.

Conclusion: Music Tone for the birthday song is successfully generated.

QUESTIONS-

1. Which function is used for the generation of the tone in MATLAB.

A sound() function is used for the generation of the sound in MATLAB

2. Is it possible to generate any tune in MATLAB

If you know the generation of sine wave, you can compose any tune in the MATLAB with
the help of tone generation program.
Experiment No 10

Aim: To implement Floating point arithmetic.

Apparatus / Tools used: MATLAB 7.0.1

Program:

1.

(a) % created a 1-by-1 array of type double for the value you just stored in x

x = 25.783;
whos x

(b) % created a 1-by-1 array of type single for the value you just stored in y
y = single(10);
whos y

2. % verify 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)

3.
% Converts a signed integer to double precision floating point

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

x = double(y) % Convert to double

4.
% Creating a single precision data
y = int64(-589324077574); % Create a 64-bit integer

x = single(y) % Convert to single-precision floating pt.

5. % Double precision operation( performs operation on data of type double and char.
Result is of type char

(a) c = 'uppercase' - 32;

class(c)

(b) char(c)
6. %Single Precision Operation
x = single([1.32 3.47 5.28]) .* 7.5;

class(x)

Result:
1.
(a) Name Size Bytes Class

x 1x1 8 double array

(b) Name Size Bytes Class

x 1x1 4 single array

2. Logical
1

3. x =
-5.8932e+11
4.
x=

single

-5.8932e+11

5. ans =
double

ans =
UPPERCASE

6. ans =
single

Conclusion: Floating Point arithmetic implemented successfully.

QUESTIONS-

1. What is floating point arithmetic


In computing, floating-point arithmetic (FP) is arithmetic using formulaic
representation of real numbers as an approximation to support a trade-off between
range and precision.

2. In what type of systems floating point arithmetic is used


Floating-point computation is often found in systems, which include very small and
very large real numbers, which require fast processing times.

3. How the floating point represented?


A number is, in general, represented approximately to a fixed number of significant
digits (the significand) and scaled using an exponent in some fixed base; the base

for the scaling is normally two, ten, or sixteen.


Experiment No 11

AIM: To study about DSP Processors and architecture of TMS320C6713 DSP


Processor.

Apparatus /Tools used: TMS320C6713 DSP processor

Theory:
TMS320C50 Architecture Overview

1. Introduction:

It is needless to say that in order to utilize the full feature of the DSP chip TMS320C50, the
DSP engineer must have a complete knowledge of the DSP device. This chapter is an
introduction to the hardware aspects of the TMS320C50. The important units of TMS320C50
are discussed.

2. The DSP Chip TMS320C50:

The TMS320C50 is a 16-bit fixed point digital signal processor that combines the flexibility
of a high speed controller with the numerical capability of an array processor, thereby offering
an inexpensive alternative to multichip bit-slice processors. The highly paralleled architecture
and efficient instruction set provide speed and flexibility capable of executing 10 MIPS
(Million Instructions per Second). The TMS320C50 optimizes speed by implementing
functions in hardware that other processors implement through microcode or software. This
hardware intensive approach provides the design engineer with processing power previously
unavailable on a single chip.

The TMS320C50 is the third generation digit l signal processor in the TMS320 family. Its
powerful instruction set, inherent flexibility, high-speed number-crunching capabilities, and
innovative architecture have made this high-performance, cost-effective processor the ideal
solution to many telecommunications, computer, commercial, industrial, and military
applications.

3. Key Features of TMS320C50:

The key features of the Digital Signal Processor TMS320C50 are:

* 35-/50-ns single-cycle fixed-point instruction execution time (28.6/20 MIPS)

* Upward source-code compatible with all `C1X and `C2x devices

* RAM-based memory operation (`C50)

* 9K x 16-bit single-cycle on-chip program/data RAM (`C50)

* 2K x 16-bit single-cycle on-chip boot ROM (`C50)

* 1056 x 16-bit dual-access on-chip data RAM


* 24K x 16-bit maximum addressable external memory space (64K program, 64K data,
64K I/O, and 32K global)

* 32-bit arithmetic logic unit (ALU), 32-bit accumulator (ACC), and 32-bit accumulator
buffer (ACCB)

* 16-bit parallel logic unit (PLU)

* 16 x 16-bit parallel multiplier with a 32-bit product capability.

* Single-cycle multiply/accumulate instructions

* Eight auxiliary registers with a dedicated auxiliary register arithmetic unit for indirect
addressing.

* Eleven context-switch registers (shadow registers) for storing strategic CPU


controlled registers during an interrupt service routine

* Eight-level hardware stack

* 0- to 16-bit left and right data barrel-shifters and a 64-bit incremental data shifter

* Two indirectly addressed circular buffers for circular addressing

* Single-instruction repeat and block repeat operations for program code

* Block memory move instructions for better program/data management

* Full-duplex synchronous serial port for direct communication between the `C5x and
another serial device

* Time-division multiple-access (TDM) serial port

* Interval timer with period, control, and counter registers for software stop, start, and
reset

* 64K parallel I/O ports, 1 6 of which are memory mapped

* Sixteen software programmable wait-state generators for program, data, and I/O
memory spaces.

4. Architecture:

A detailed architectural block diagram of TMS320C50 is illustrated in Figure 1-1. The


TMS320C50 utilizes a modified Harvard architecture for speed and flexibility. In a strict
Harvard architecture, program and data memory are in two separate spaces, permitting a full
overlap of instruction fetch and execution. The TMS320 family's modification of the Harvard
architecture allows transfer between program and data spaces, thereby increasing the flexibility
of the device. This modification permits coefficients stored in program memory to be re ad into
the data RAM, eliminating the need for a separate coefficient ROM. It also makes available
immediate instructions and subroutines based on computed values

4.1 32-Bit Accumulator:


The TMS320C50 contains a 32-bit ALU and accumulator for support of double-precision,
two's complement arithmetic. The ALU is a general purpose arithmetic unit that operates on
16-bit words taken from the data RAM or derived from immediate instructions. In addition to
the usual arithmetic instructions, the ALU can perform Boolean operations, providing the bit
manipulation ability required of a high-speed controller. The accumulator stores the output
from the A LU and is often an input to the ALU. Its word length is 32-bit. The accumulator is
divided into a high order word (bits 31 through 16) and a low-order word (bits 15 through 0).
Instructions are provided for storing and loading the high and lower order accumulator words
to memory.

Block Diagram of TMS320C613 Processor

4.2 16 x 16-Bit Parallel Multiplier:

The multiplier performs a 16 x 16-bit two's complement multiplication with a 32-bit result in
a single instruction cycle. The multiplier consists of three units: the T-Register, P-Register, and
multiplier array. The 16-bit T-Register temporarily stores the multiplicand and the P-Register
stores the 32-bit product. Multiplier values either come from the data memory or are derived
immediately from the MPY (multiply immediate) instruction word. The fast on-chip multiplier
allows the device to perform fundamental operations such as convolution, correlation, and
filtering. Two multiply/accumulate instructions in the instruction set fully utilize the
computational bandwidth of the multiplier, allowing both operands to be processed
simultaneously.

4.3 Shifters:

A 16-bit scaling shifter is available at the accumulator input. This shifter produces a left shift
of 0 to 16-bits on the input data to accumulator.
TMS320C50 also contains a shifter at the accumulator output. This shifter provides a left shift
of 0 to 7, on the data from either the ACCH or ACCL register, right, before transferring the
product to accumulator.

4.4 Date and Program Memory:

Since the TMS320C50 uses Harvard architecture, data and program memory reside in two
separate spaces. Additionally TMS320C50 has one more memory space called I/O memory
space. The total memory capacity of TMS320C50 is 64KW each of Program, Data and I/O
memory. The 64KW of data memory is divided into 512 pages with each page containing 128
words. Only one page can be active at a time. One data page selection is done by setting data
page pointer. TMS320C50 has 1056 words of dual access on chip data RAM and 9K words of
single access Data/Program RAM. The 1056 words of on chip data memory is divided as three
blocks B0, B1 & B2, of which B0 can be configured as program or data RAM.

Out of the 64KW of total program memory, TMS320C50 has 2K words of on-chip program
ROM. The TMS320C50 offers two modes of operation defined by the state of the MC/MP pin:
the microcomputer mode (MC/MP = 1) or the microprocessor mode (MC/MP = 0). In the
microcomputer mode, on-chip ROM is mapped into the memory space with upto 2K words of
memory available. In the microprocessor mode all 64K words of program memory are external.

4.5 Interrupts and Subroutines:

The TMS320C50 has three external maskable user interrupts available for external devices that
interrupt the processor. The TMS320C50 contains an eight-level hardware stack for saving the
contents of the program counter during interrupts and subroutine calls. Instructions are
available for saving the device's complete context. PUSH and POP instructions permit a level
of nesting restricted only by the amount of available RAM.

4.6 Serial Port:

A full-duplex on-chip serial port provides direct communication with serial devices such as
codecs, serial A/D converters and other serial systems. The interface signals are compatible
with codecs and many others serial devices with a minimum of external hardware.

4.7 Input and Output: The 16-bit parallel data bus can be utilised to perform I/O functions in
two cycles. The I/O ports are addressed by the four LSBs on the address lines, allowing 16
input and 16 output ports. In addition, polling input for bit test and jump operations (BIO) and
three interrupt pins (INT0 - INT2) have been incorporated for multitasking.

Software Overview

This chapter illustrates the use of program and execution mainly in the standalone mode.

The Micro-50 EB has 3 software development tools namely

1. Standalone Mode

2. Monitor program

3. Serial Mode
In "Standalone Mode" the Micro-50 EB works with a 104 keys keyboard and 16x2 LCD
display and line assembler. With this configuration, the student can enter his program through
the keyboard and edit and display it on the LCD display. The user can enter the Mnemonics
using the Line Assembler, and debug the program to run it on Micro-50 EB.

"Monitor Program" is used to enter data directly into Data or Program memory, display the
data etc. It has several commands to enter the user program, for editing and debugging.

In "Serial Mode", it works with a IBM PC computer and program entry and debugging is done
at the PC level.

QUESTIONS-

1. What is the difference between analog and digital signal?


ASP (Analog signal processing) processes the signals, which are not digitized. The
examples of ASP systems include classical radio, TV, telephone, radar etc. DSP
processes discrete time discrete amplitude signals, which are samples at discrete points
in time. The most popular DSP chip is from texas instruments, which is TMS320. The
other DSP manufacturers include freescale, Intel, CEVA, XILINX etc.

2. What are main parts of the Processor?


The main part of the processor are:
CPU, peripherals and Memory

3. What are main units contained in the CPU?


The CPU contains Program fetch unit, Instruction dispatch unit and Instruction
Decode unit.

4. Difference between the DSP processor and Microprocessor.


All the microprocessors are capable of doing data manipulation and mathematical
calculations tasks but it is difficult to make a device, which can perform both the
functions optimally, because of the involved technical tradeoffs like the size of the
instruction set, how interrupts are handled etc. As a broad generalization, these factors
have made traditional microprocessors such as Pentium Series, primarily directed at
data manipulation. Similarly, DSPs are designed to perform the mathematical
calculations needed in Digital Signal Processing,

5. What are the advantages of DSP’s over Analog Circuits.


Advantages of DSP over analog circuits listed below:
a) Can implement complex linear or nonlinear algorithms.
b) Can modify easily by changing software.
c) Reduced parts count makes fabrication easier.
Experiment No 13

Aim: Implementation of FFT of given sequence and obtain the magnitude and phase response
of the same.

Apparatus Required: MATLAB (version 7.0.1)

PROGRAM

%To compute the FFT for the given sequence and plot magnitude and phase response

clc;
clear all;
close all;
%exponential sequence
n=input('enter the length of input sequence: ');
t=0:1:n;
y=input('enter the input sequence');
disp(y);
subplot(3,1,1);
stem(t,y);
grid;
title('input sequence');
xlabel('time');
ylabel('amplitude');
disp(y);
xn=y;
N=input('enter the length of the FFT sequence: ');
xk=fft(xn,N);
magxk=abs(xk);
angxk=angle(xk);
k=0:N-1;
subplot(3,1,2);
stem(k,magxk);
grid;
xlabel('k');
ylabel('|x(k)|');
title('magnitude response')
subplot(3,1,3);
stem(k,angxk);
grid;
disp(xk);
xlabel('k');
ylabel('arg(x(k))');
title('angular response')
Output
enter the length of input sequence: 5

enter the input sequence[1 2 -1 -2 0 3]

1 2 -1 -2 0 3

enter the length of the FFT sequence: 8

Columns 1 through 4

3.0000 1.7071 + 3.1213i 2.0000 - 7.0000i 0.2929 + 1.1213i

Columns 5 through 8

-3.0000 0.2929 - 1.1213i 2.0000 + 7.0000i 1.7071 - 3.1213i

Waveform:

RESULT:

Thus the FFT of given sequence implemented and verified.

QUESTIONS-
1. What is the difference between DFT and FFT?
A DFT (Discrete Fourier Transform) is simply the name given to the Fourier Transform when
it is applied to digital (discrete) rather than an analog (continuous) signal. An FFT (Fast Fourier
Transform) is a faster version of the DFT that can be applied when the number of samples in
the signal is a power of two. An FFT computation takes approximately N * log2(N) operations,
whereas a DFT takes approximately N^2 operations, so the FFT is significantly faster.

2. How to calculate output of DFT using MATLAB?


X = fft(x);
plot(abs(X))

3. What is the role of convolution in finding the impulse response of a system?


Convolution is a very powerful technique that can be used to calculate the zero state response
(i.e., the response to an input when the system has zero initial conditions) of a system to an
arbitrary input by using the impulse response of a system

4. What is an LTI system?


Linear time-invariant system theory, commonly known as LTI system theory, comes from
applied mathematics and has direct applications in NMR spectroscopy, seismology, circuits,
signal processing, control theory, and other technical areas. It investigates the response of a
linear and time-invariant system to an arbitrary input signal. Trajectories of these systems are
commonly measured and tracked as they move through time (e.g., an acoustic waveform).
Experiment No 14
Aim: Verify Rectangular window Technique.

Apparatus Required: MATLAB (version 7.0.1)

PROGRAM

%Rectangular Window

% Rectangular Window
clc;
clear all;
close all;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband frequency');
fs=input('enter the stopband frequency');
f=input('enter the sampling frequency');
wp=2*fp/f;
ws=2*fs/f;
num=(-20*log10(sqrt(rp*rs))-13);
dem=(14.6*(fs-fp)/f);
n=ceil(num/dem);
n1=n+1;
if(rem(n,2)~=0)
n1=n;
n=n-1;
end
y=rectwin(n1);

%for lowpass filter


b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,3,1);
plot(o/pi,m);
ylabel('Gain in DB---->');
xlabel('Normalized frequency');
title('Low Pass');

%for highpass filter


b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,3,2);
plot(o/pi,m);
ylabel('Gain in DB---->');
xlabel('Normalized frequency');
title('High Pass');

Output

For Rectangular:
Enter the passband ripple .05
Enter the stop band ripple 0.04
Enter the passband freq 1500
Enter the stopband freq 2000
Enter the sampling freq 9000

Waveform:

RESULT:

Thus the Rectangular window technique is verified.

QUESTIONS-

1. What is the need for a filter?


Digital filters that incorporate digital-signal-processing (DSP) techniques have
received a great deal of attention in technical literature in recent years. Although
they rarely serve as anti-aliasing filters (in fact, they need anti-aliasing filters),
digital filters merit discussion here because digital filters offer features that have no
counterparts in other filter technologies.

2. What is meant by cut off in filters?


Typically, in electronic systems such as filters and communication channels, cutoff
frequency applies to an edge in a lowpass, highpass, bandpass, or band-stop
characteristic – a frequency characterizing a boundary between a passband and a
stopband. It is sometimes taken to be the point in the filter response where a
transition band and passband meet, for example as defined by a 3 dB corner, a
frequency for which the output of the circuit is −3 dB of the nominal passband
value. Alternatively, a stopband corner frequency may be specified as a point where
a transition band and a stopband meet: a frequency for which the attenuation is
larger than the required stopband attenuation, which for example may be 30 dB or
100 dB

3. What is FIR filter?


A finite impulse response (FIR) filter is a type of a signal-processing filter whose
impulse response (or response to any finite length input) is of finite duration,
because it settles to zero in finite time

4. What is the windowing method


Windows are sometimes used in the design of digital filters, in particular to convert
an "ideal" impulse response of infinite duration, such as a sinc function, to a finite
impulse response (FIR) filter design. That is called the window method.

5. What is the significance of windowing method?


Windowing reduces the amplitude of the discontinuities at the boundaries of each
finite sequence acquired by the digitizer.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy