0% found this document useful (0 votes)
58 views76 pages

DSP Lab r20 Regulation

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)
58 views76 pages

DSP Lab r20 Regulation

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/ 76

EDUCATIONAL ACADEMY

SIDDARTHA GROUP OF INSTITUTIONS

ENGINEERING & MBA


Approved by AICTE, New Delhi & Affiliated to JNTUA Ananthapuramu
Near C. Gollapalli, Tirupati – 517 505

OBSERVATION BOOK

Roll Number :_____________________________________________

Name of the Student :_____________________________________________

Course / Year / Semester :_____________________________________________

Branch :_____________________________________________

Name of the Laboratory :_____________________________________________


JNTUA B.Tech. R20 Regulations

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY ANANTAPUR


B.Tech (ECE)– III-I Sem L T P C
0 0 3 1.5
(20A04502P) DIGITAL SIGNAL PROCESSING LAB
Course Outcomes:
 Implement various DSP Algorithms using software packages.
 Implement DSP algorithms with Digital Signal Processor.
 Analyze and observe magnitude and phase characteristics (Frequency response
Characteristics) of digital IIR-Butterworth, Chebyshev filters.
 Analyze and observe magnitude and phase characteristics (Frequency response
Characteristics) of digital FIR filters using window techniques.
 Analyze digital filters using Software Tools.

The Programs shall be implemented in Software (Using MATLAB / Lab View / C Programming/
Equivalent) and Hardware (Using TI / Analog Devices / Motorola / Equivalent DSP processors).

List of Experiments:
1. Generate the following standard discrete time signals.
i) Unit Impulse ii) Unit step iii) Ramp iv) Exponential v) Sawtooth
2. Generate sum of two sinusoidal signals and find the frequency response (magnitude and
phase).
3. Implement and verify linear and circular convolution between two given signals.
4. Implement and verify autocorrelation for the given sequence and cross correlation between
two given signals.
5. Compute and implement the N-point DFT of a given sequence and compute the power
density spectrum of the sequence.
6. Implement and verify N-point DIT-FFT of a given sequence and find the frequency response
(magnitude and phase).
7. Implement and verify N-point IFFT of a given sequence.
8. Design IIR Butterworth filter and compare their performances with different orders (Low
Pass Filter /High Pass Filter)
9. Design IIR Chebyshev filter and compare their performances with different orders (Low Pass
Filter /High Pass Filter).
10. Design FIR filter (Low Pass Filter /High Pass Filter) using windowing technique.
i. Using rectangular window
ii. Using hamming window
iii. Using Kaiser window
11. Design and verify Filter (IIR and FIR) frequency response by using Filter design and Analysis
Tool.
12. Compute the Decimation and Interpolation for the given signal.
13. Real time implementation of an audio signal using a digital signal processor.
14. Compute the correlation coefficient for the two given audio signals of same length using a
digital signal processor.

Note: Any TWELVE of the experiments are to be conducted.


References:
1. Digital Signal Processing: Alon V. Oppenhelm, PHI
2. Digital Signal processing(II-Edition): S.K. Mitra, TMH
Online Learning Resources/Virtual Labs:
1. http://vlabs.iitkgp.ac.in/dsp/#
20A04502P - Digital Signal Processing Lab

JNTUA LIST OF EXPERIMENTS


DIGITAL SIGNAL PROCESSING LAB (20A04502P)

The Programs shall be implemented in Software (Using MATLAB / Lab View / C


Programming/ Equivalent) and Hardware (Using TI / Analog Devices / Motorola / Equivalent
DSP processors).
List of Experiments:
1. Generate the following standard discrete time signals.
i) Unit Impulse ii) Unit step iii) Ramp iv) Exponential v) Sawtooth
2. Generate sum of two sinusoidal signals and find the frequency response (magnitude and
phase).
3. Implement and verify linear and circular convolution between two given signals.
4. Implement and verify autocorrelation for the given sequence and cross correlation
between two given signals.
5. Compute and implement the N-point DFT of a given sequence and compute the power
density spectrum of the sequence.
6. Implement and verify N-point DIT-FFT of a given sequence and find the frequency
response (magnitude and phase).
7. Implement and verify N-point IFFT of a given sequence.
8. Design IIR Butterworth filter and compare their performances with different orders (Low
Pass Filter /High Pass Filter)
9. Design IIR Chebyshiev filter and compare their performances with different orders (Low
Pass Filter /High Pass Filter).
10. Design FIR filter (Low Pass Filter /High Pass Filter) using windowing technique.
i. Using rectangular window ii. Using hamming window iii. Using Kaiser window
11. Design and verify Filter (IIR and FIR) frequency response by using Filter design and
Analysis Tool.
12. Compute the Decimation and Interpolation for the given signal.
13. Real time implementation of an audio signal using a digital signal processor.
14. Compute the correlation coefficient for the two given audio signals of same length using a
digital signal processor.

Note: Any TWELVE of the experiments are to be conducted.

DEPT. OF ECE, SEAGI Page 1


20A04502P - Digital Signal Processing Lab

LABORATORY INSTRUCTIONS
➢ While entering the Laboratory, the students should leave the footwear
outside the lab. Female Students should tie their hair back.
➢ The students should bring their observation note book, practical manual,
record note book and calculator and necessary stationary items for the lab
classes without which the students will not be allowed for doing the
practical.
➢ Each experiment after completion should be written in the observation note
book and should be corrected by the lab in charge on the same day of the
practical class.
➢ Each experiment should be written in the record note book only after getting
signature from the lab in charge in the observation note book.
➢ Record note book should be submitted in the next lab after completion of
experiment.
➢ 100% attendance should be maintained for the practical classes
INTRODUCTION TO MATLAB
INTRODUCTION: MATLAB is a mathematical software package which is used extensively
in academic and industry.
➢ MATLAB stands for MATrix LABoratory.
➢ It is one of the leading Scientific and Technical computing software, used by many
engineers and scientists.
➢ This was developed by CLEVE MOLER, a professor of mathematics and computer
science.
➢ Over the last two decades MATLAB has evolved into a much powerful and versatile
package, useful for a wide variety of academic, research and industrial applications.
IMPORTANCE OF MATLAB:
➢ As a matrix based system it is great tool for simulation and data analysis.
➢ It is simple, powerful and easy to learn programming language as it provides extensive
online help.
➢ Unlike other high-level languages like FORTRAN, C, etc., it does not require any
variable declaration and dimension statements at the beginning.

DEPT. OF ECE, SEAGI Page 2


20A04502P - Digital Signal Processing Lab

➢ MATLAB programs written for solving complex problems take a fraction of time and
look very small in general when compared to the codes of high-level language.
➢ It also enables the users to write their own functions for easy customization.
➢ It is excellent and very powerful for two and three dimensional graphics and animation.
➢ It is an indispensable Graphical User Interface (GUI) tool and used for proper
understanding of concepts in advanced subjects like mathematics, signals and systems,
control systems, digital signal processing, VLSI design, etc .
➢ It also provides several optional ‘tool boxes’ such as statistics toolbox, control system
toolbox, signal processing toolbox, etc. where toolbox provides a set of functions written
for specific application.
➢ It is compatible, with most operating systems such as windows, Linux, etc.
➢ It uses matrix notation it replaces several ‘for’ loops which are usually found in C type of
codes.
GETTING STARTED WITH MATLAB:
➢ LAUNCHING MATLAB: If MATLAB is installed on your computer, you can possibly
find the MATLAB icon as a shortcut on your desktop of the windows-based system, after
you login to the computer using your user id and the password.
➢ MATLAB DESKTOP LAYOUT: When you launch MATLAB for the first time the
MATLAB desktop appears with a default layout. You can change the desktop
configuration to suits your need.

DEPT. OF ECE, SEAGI Page 3


20A04502P - Digital Signal Processing Lab

INDEX

S.NO DATE TITLE SIGNATURE

DEPT. OF ECE, SEAGI Page 4


20A04502P - Digital Signal Processing Lab

EXPERIMENT: 1 DATE:___________

Generate the following standard discrete time signals.


i) Unit Impulse ii) Unit step iii) Ramp iv) Exponential v) Sawtooth
AIM: To generate unit impulse, unit step, ramp exponential and Sawtooth signal sign MATLAB
Program for the generation of a random signal
EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE: -
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAMS:
%Unit impulse generation
clc;
close all;
n1=-3;
n2=4;
n0=0;
n= [n1:n2];
x= [(n-n0)==0]
stem(n,x);
xlabel(‘samples’);ylabel(‘amplitude’); title(‘unit impulse’);
%generation of unit step signal
n=0:1:20;
y3= (n>=0);
figure;
subplot(2,1,1);
plot(n,y3);
xlabel('time');
DEPT. OF ECE, SEAGI Page 5
20A04502P - Digital Signal Processing Lab

ylabel('amplitude');
title('unit step signal');
%generation of unit step sequence
subplot(2,1,2);
stem(n,y3);
xlabel('n');
ylabel('amplitude');
title('unit step sequence');

% Ramp signal
clc;
close all;
n= input('enter the length of ramp');
t= 0: n;
subplot(2,1,1)
plot(t);
xlabel('t');
ylabel('amplitude');
title ('ramp signal')
subplot(2,1,2);stem(t);
xlabel('n');
ylabel('amplitude');
title ('ramp sequence')

%generation of exponential sequence


clear all;
close all;
clc;
x=0:0.1:10;
y=exp(2*x);
stem(y);
xlabel('samples');
ylabel('amplitude');
title('exponential sequence');

DEPT. OF ECE, SEAGI Page 6


20A04502P - Digital Signal Processing Lab

%generation of sawtooth signal


y5=sawtooth(2*pi*50*t);
figure;
subplot(2,1,1);
plot(t,y5);
axis([0 0.1 -2 2]);
xlabel('time'); ylabel('amplitude');
title('sawtooth wave signal');
subplot(2,1,2);
stem(t,y5);

OUTPUT WAVE FORMS:

Figure 1: Unit impulse function

DEPT. OF ECE, SEAGI Page 7


20A04502P - Digital Signal Processing Lab

Figure 2. Unit step function.

Figure 3: Unit ramp signal

DEPT. OF ECE, SEAGI Page 8


20A04502P - Digital Signal Processing Lab

8
x 10 exponential sequence
5

4.5

3.5

3
amplitude

2.5

1.5

0.5

0
0 20 40 60 80 100 120
samples

Figure 4: Exponential sequence

Figure 5: Sawtooth wave signal

RESULT:

DEPT. OF ECE, SEAGI Page 9


20A04502P - Digital Signal Processing Lab

EXPERIMENT: 2 DATE:___________

Generate sum of two sinusoidal signals and find the frequency response
(magnitude and phase).
AIM: To write a MATLAB program to generate and add two sinusoidal signals

EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAM:

clear all;
close all;
clc;
a1 = input('amplitude of signal 1');
a2 = input('amplitude of signal 2');
f1 = input('frequency of signal 1');
f2 = input('frequency of signal 2');
p1 = input('phase of signal 1');
p2 = input('phase of signal 2');
t = 0: 2*pi/100 : 2*pi;
x = a1 * sin (f1*t + p1);
y = a2 * sin(f2*t + p2);
z = x+y;
subplot(4,1,1); plot(t,x,'-g');%displays sine signal 1
subplot(4,1,2); plot(t,y,'-g');%displays sine signal 2
subplot(4,1,3); plot(t,z,'-b');%displays sum of two signals
DEPT. OF ECE, SEAGI Page 10
20A04502P - Digital Signal Processing Lab

subplot(4,1,4); plot(x,y,'-r');%displays Lissazous pattern


title('LISSAJOUS');
Inputs:
Amplitude of signal 1 :2
Amplitude of signal 2 :2
Frequency of signal 1 :5
Frequency of signal 2 :5
Phase of signal 1 :0
Phase of signal 2 :pi/2

Wave forms:

RESULT:

DEPT. OF ECE, SEAGI Page 11


20A04502P - Digital Signal Processing Lab

EXPERIMENT: 3 DATE:___________

Implement and verify linear and circular convolution between two given
signals.
AIM: To write a MATLAB Program and finding the Convolution (linear & circular) of discrete
sequence without using built in functions.
EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window

Program:
%Linear Convolution
clc;
clear all;
close all;
disp ('linear convolution program');
x=input('enter input x(n):');
m=length(x);
h=input('enter input h(n):');
n=length(h);
x=[x,zeros(1,n)];
l1=0:length(x)-1;
subplot(2,2,1);
stem(l1,x);

DEPT. OF ECE, SEAGI Page 12


20A04502P - Digital Signal Processing Lab

title('i/p sequence x(n)is:');


xlabel('---->n');
ylabel('---->x(n)');grid;
h=[h,zeros(1,m)];
l2=0:length(h)-1;
subplot(2,2,2);
stem(l2,h);
title('i/p sequence h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');grid;
disp('convolution of x(n) & h(n) is y(n):');
y=zeros(1,m+n-1);
for i=1:m+n-1
y(i)=0;
for j=1:m+n-1
if(j<i+1)
y(i)=y(i)+x(j)*h(i-j+1);
end
end
end
disp(y);
l3=m+n-1;
n1=0:l3-1;
subplot(2,2,[3,4]);
stem(n1,y);
title('Linear Convolution of x(n) & h(n) is :');
xlabel('---->n');
ylabel('---->y(n)');
grid;

DEPT. OF ECE, SEAGI Page 13


20A04502P - Digital Signal Processing Lab

OUTPUT:
Linear convolution program
Enter i/p x(n):[1 2 3]
Enter i/p h(n):[3 4 5]
Convolution of x(n) & h(n) is y(n):
3 10 22 22 15

%Circular Convolution
clc;
clear all;
close all;
disp('circular convolution program');
x= input('enter input x(n):');
m=length(x);
h=input('enter input sequence h(n)');
n=length(h);
subplot(2,2,1), stem(x);
title(‘input sequencce x(n)is:');
xlabel('---->n');
ylabel('---->x(n)');grid;
subplot(2,2,2), stem(h);
title('input sequencce h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');grid;
disp('circular convolution of x(n) & h(n) is y(n):');
if(m-n~=0)
if(m>n)

DEPT. OF ECE, SEAGI Page 14


20A04502P - Digital Signal Processing Lab

h=[h,zeros(1,m-n)];
n=m;
end
x=[x,zeros(1,n-m)];
m=n;end
y=zeros(1,n);
y(1)=0;
a(1)=h(1);
for j=2:n
a(j)=h(n-j+2);
end
%ciruclar conv
for i=1:n
y(1)=y(1)+x(i)*a(i);
end
for k=2:n
y(k)=0;
% circular shift
for j=2:n
x2(j)=a(j-1);
end
x2(1)=a(n);
for i=1:n
if(i<n+1)
a(i)=x2(i);
y(k)=y(k)+x(i)*a(i);
end
end
end

DEPT. OF ECE, SEAGI Page 15


20A04502P - Digital Signal Processing Lab

disp(y);
subplot(2,2,[3,4]),stem(y);
title('Circular convolution of x(n) & h(n) is:');
xlabel('---->n');
ylabel('---->y(n)');
grid;

OUTPUT:
Circular Convolution Program
Enter I/P x(n):[1 2 3]
Enter I/P Sequence h(n):[4 6 7]
Circular Convolution of x(n) & h(n) Is y(n):
36 35 31

i/p sequence x(n)is: i/p sequence h(n)is:


3 5

4
2
---->x(n)

---->h(n)

2
1
1

0 0
0 1 2 3 4 5 0 1 2 3 4 5
---->n ---->n
Linear Convolution of x(n) & h(n) is :
30

20
---->y(n)

10

0
0 0.5 1 1.5 2 2.5 3 3.5 4
---->n

DEPT. OF ECE, SEAGI Page 16


20A04502P - Digital Signal Processing Lab

i/p sequencce x(n)is: i/p sequencce h(n)is:


3 8

6
2
---->x(n)

---->h(n)
4
1
2

0 0
1 1.5 2 2.5 3 1 1.5 2 2.5 3
---->n ---->n
Circular convolution of x(n) & h(n) is:
40

30
---->y(n)

20

10

0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
---->n

RESULTS

DEPT. OF ECE, SEAGI Page 17


20A04502P - Digital Signal Processing Lab

EXPERIMENT: 4 DATE:___________

Implement and verify autocorrelation for the given sequence and cross
correlation between two given signals.
AIM: To write a MATLAB Program and finding the Convolution (linear & circular) of discrete
sequence without using built in functions.
EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE: -
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAM:
%Cross Correlation
clc;
clear all;
close all;
z=input('Enter first sequence x(n):');
n1=length(z);
x=fliplr(z);
m=length(x);
h=input('Enter Second sequence h(n):');
n=length(h);
l1=0:n1-1;
figure;
subplot(2,2,1);
stem(l1,z);

DEPT. OF ECE, SEAGI Page 18


20A04502P - Digital Signal Processing Lab

title('First sequence x(n)is:');


xlabel('---->n');
ylabel('---->x(n)');
grid;
l2=0:n-1;
subplot(2,2,2);
stem(l2,h);
title('Second sequence h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');
grid;
x=[x,zeros(1,m)];
h=[h,zeros(1,m)];
disp('Cross Correlation of x(n) & h(n) is y(n):');
y=zeros(1,m+n-1);
for i=1:m+n-1
y(i)=0;
for j=1:m+n-1
if(j<i+1)
y(i)=y(i)+x(j)*h(i-j+1);
end
end
end
disp(y);
l3=-(m-1):(n-1);
subplot(2,2,[3,4]);
stem(l3,y);
title('Cross Correlation of x(n) & h(n) is :');
xlabel('---->n');

DEPT. OF ECE, SEAGI Page 19


20A04502P - Digital Signal Processing Lab

ylabel('---->y(n)');
grid;

OUTPUT:
%Cross Correlation
Enter first sequence x(n):[1 2 3]
Enter Second sequence h(n):[4 5]
Cross Correlation of x(n) & h(n) is y(n):
12 23 14 5

%Auto Correlation
clc;
clear all;
close all;
x=input('Enter the sequence x(n):');
n=length(x);
z=fliplr(x);
m=length(z);
l1=0:n-1;
figure;
subplot(2,1,1);
stem(l1,x);
title('Input Sequence x(n)is:');
xlabel('---->n');
ylabel('---->x(n)');
grid;
x=[x,zeros(1,m)];
z=[z,zeros(1,n)];
disp('Auto Correlation of x(n) & x(n) is y(n):');

DEPT. OF ECE, SEAGI Page 20


20A04502P - Digital Signal Processing Lab

y=zeros(1,m+n-1);
for i=1:m+n-1
y(i)=0;
for j=1:m+n-1
if(j<i+1)
y(i)=y(i)+z(j)*x(i-j+1);
end
end
end
disp(y);
l2=-(n-1):(n-1);
subplot(2,1,2);
stem(l2,y);
title('Auto Correlation of x(n) & x(n) is :');
xlabel('---->n');
ylabel('---->y(n)');
grid;

OUTPUT:
%Auto Correlation
Enter the sequence x(n):[1 2 3]
Auto Correlation of x(n) & x(n)is y(n):
3 8 14 8 3

DEPT. OF ECE, SEAGI Page 21


20A04502P - Digital Signal Processing Lab

First sequence x(n)is: Second sequence h(n)is:


3 6

2 4
---->x(n)

---->h(n)
1 2

0 0
0 0.5 1 1.5 2 0 0.2 0.4 0.6 0.8 1
---->n ---->n
Cross Correlation of x(n) & h(n) is :
30

20
---->y(n)

10

0
-2 -1.5 -1 -0.5 0 0.5 1
---->n

Input Sequence x(n)is:


3

2
---->x(n)

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
---->n
Auto Correlation of x(n) & x(n) is :
15

10
---->y(n)

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
---->n

RESULTS:

DEPT. OF ECE, SEAGI Page 22


20A04502P - Digital Signal Processing Lab

EXPERIMENT: 5 DATE:___________

Compute and implement the N-point DFT of a given sequence and compute
the power density spectrum of the sequence.
AIM: To Compute and implement the N-point DFT of a given sequence and compute the power
density spectrum of the sequence.
EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE: -
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAM:
% Program to find the DFT/IDFT of a sequence without using the inbuilt functions
clc
close all;
clear all;
xn=input('Enter the sequence x(n)'); %Get the sequence from user
ln=length(xn); %find the length of the sequence
xk=zeros(1,ln); %initilise an array of same size as that of input sequence
ixk=zeros(1,ln); %initilise an array of same size as that of input sequence
%code block to find the DFT of the sequence
for k=0:ln-1
for n=0:ln-1
xk(k+1)=xk(k+1)+(xn(n+1)*exp((-i)*2*pi*k*n/ln));
end
end
%code block to plot the input sequence
t=0:ln-1;
subplot(221);
stem(xn);
grid
ylabel ('Amplitude');
xlabel ('Time Index');
title('Input Sequence');
magnitude=abs(xk); % Find the magnitudes of individual DFT points
%code block to plot the magnitude response

DEPT. OF ECE, SEAGI Page 23


20A04502P - Digital Signal Processing Lab

t=0:ln-1;
subplot(222);
stem(t,magnitude);
grid
ylabel ('Amplitude');
xlabel ('K');
title ('Magnitude Response');
phase=angle(xk); % Find the phases of individual DFT points
%code block to plot the magnitude sequence
t=0:ln-1;
subplot(223);
stem(t,phase);
grid
ylabel ('Phase');
xlabel ('K');
title('Phase Response');
% Code block to find the IDFT of the sequence
for n=0:ln-1
for k=0:ln-1
ixk(n+1)=ixk(n+1)+(xk(k+1)*exp(i*2*pi*k*n/ln));
end
end
ixk=ixk./ln;
%code block to plot the input sequence
t=0:ln-1;
subplot(224);
stem(t,xn);
grid;
ylabel ('Amplitude');
xlabel ('Time Index');
title ('IDFT sequence');subplot(3,1,3);
phase=angle(X);
stem(k,phase);
title('Phase Spectrum');
xlabel('k');
ylabel('Phase');
grid;
OUTPUT

DEPT. OF ECE, SEAGI Page 24


20A04502P - Digital Signal Processing Lab

RESULT:

DEPT. OF ECE, SEAGI Page 25


20A04502P - Digital Signal Processing Lab

EXPERMENT: 6 DATE:___________

Implement and verify N-point DIT-FFT of a given sequence and find the
frequency response (magnitude and phase).
AIM: To Implement and verify N-point DIT-FFT of a given sequence and find the frequency
response (magnitude and phase).
EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAM:-
clc; clear all;
x = input('Enter the input sequence = '); N = length(x);
for k = 1:N y(k) = 0;
for n = 1:N
y(k) =y(k)+x(n)*exp(-1i*2*pi*(k-1)*(n-1)/N); end
end
%code block to plot the input sequence t = 0:N-1;
subplot(2,2,1);
stem(t,x); ylabel('Amplitude ---->');
xlabel('n ---->'); title('Input Sequence'); grid on;
magnitude = (y); % Find the magnitudes of individual FFT points disp('FFT
Sequence = ');
disp(magnitude);
%code block to plot the FFT sequence t = 0:N-1;

DEPT. OF ECE, SEAGI Page 26


20A04502P - Digital Signal Processing Lab

subplot(2,2,2); stem(t,magnitude); ylabel('Amplitude ---->');


xlabel('K ---->'); title('FFT Sequence'); grid on;

THEORITICAL CALCULATIONS:

INPUT: Enter the input sequence = [1 1 1 1 1 1 0 0]

OUTPUT:

FFT
Sequence =
Columns 1
through 5

6.0000 -0.7071 - 1.7071i 1.0000 - 1.0000i 0.7071+0.2929i 0 -0.0000i

Columns 6 through 8

0.7071 - 0.2929i 1.0000 + 1.0000i -0.7071 + 1.7071i

DEPT. OF ECE, SEAGI Page 27


20A04502P - Digital Signal Processing Lab

EXPERIMENT: 7 DATE:___________

Implement and verify N-point IFFT of a given sequence

AIM: To Implement and verify N-point IFFT of a given sequence

EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAM:
clc;

clear all;

x = input('Enter the input sequence = '); N = length(x);

for k = 1:N y(k) = 0;


for n = 1:N
y(k) =y(k)+x(n)*exp(1i*2*pi*(k-1)*(n-1)/N);
end
end
%code block to plot the input sequence t = 0:N-1;
subplot(2,2,1);
stem(t,x); ylabel('Amplitude ---->');

xlabel('n ---->'); title('Input Sequence'); grid on; R = length(y); for n = 1:R x1(n) = 0;

for k = 1:R

x1(n) = x1(n)+(1/R)*y(k)*exp(1i*2*pi*(k -1)*(n-1)/R);

DEPT. OF ECE, SEAGI Page 28


20A04502P - Digital Signal Processing Lab

end

end

%code block to plot the IFFT


sequence

t = 0:R-1;

subplot(2,2,3);

stem(t,x1);

disp('IFFT Sequence = ');

disp(x1);

ylabel('Amplitude ---->');

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

title('IFFT sequence');

grid on;

INPUT

input Sequence =
[
6.0000 -0.7071 - 1.7071i 1.0000 - 1.0000i 0.7071+0.2929i 0 -0.0000i

0.7071 - 0.2929i 1.0000 + 1.0000i -0.7071 + 1.7071i]

OUTPUT:

[1 1 1 1 1 1 0 0]

DEPT. OF ECE, SEAGI Page 29


20A04502P - Digital Signal Processing Lab

EXPERMENT: 8 DATE:___________

Design IIR Butterworth filter and compare their performances with different orders (Low Pass
Filter /High Pass Filter)

AIM: To design IIR Butterworth filter and compare their performances with different orders
(Low Pass Filter /High Pass Filter)

EQUIPMENTS REQUIRED:
PC with MATLAB Software

PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window

PROGRAM:
%IIR/LP
clear all; close all
%INPUT:-
fp=input('Enter the pass band frequency
fp = '); fs=input('Enter the stop band frequency fs = ');
rp=input('Enter the pass band attenuation rp = ');
rs=input('Enter the stop band attenuation rs = ');
f=input ('Enter the sampling frequency f = ');
wp=2*fp/f;

ws=2*fs/f; [n,wn]=buttord(wp,ws,rp,rs);

[b,a]=butter(n,wn,'low'); freqz(b,a,500,f);

title ('Magnitude and phase response of the IIR butter worth filter');

DEPT. OF ECE, SEAGI Page 30


20A04502P - Digital Signal Processing Lab

INPUTS:
Enter the pass band
frequency fp = 20 Enter the
stop band frequency fs = 50
Enter the pass band
attenuation rp = 1 Enter the
stop band attenuation rs = 2
Enter the sampling
frequency f =1000

OUTPUT:

IIR/HP
clear all; close all;
fp=input('Enter the pass band frequency fp =');
fs=input('Enter the stop band frequency fs = ');
rp=input('Enter the pass band attenuation rp = ');
rs=input('Enter the stop band attenuation rs = ');
f=input ('Enter the sampling frequency f =');
wp=2*fp/f; ws=2*fs/f;
[n,wn]=buttord(wp,ws,rp,rs);
[b,a]=butter(n,wn,'high'); freqz(b,a,500,f);
title ('Magnitude and phase respose of the IIR butterworth filter');

DEPT. OF ECE, SEAGI Page 31


20A04502P - Digital Signal Processing Lab

INPUT:-
Enter the pass band frequency fp = 20
Enter the stop band frequency fs = 50
Enter the pass band attenuation rp = 1
Enter the stop band attenuation rs = 2
Enter the sampling frequency f =1000

OUTPUT:

RESULT:

DEPT. OF ECE, SEAGI Page 32


20A04502P - Digital Signal Processing Lab

EXPERMENT: 9 DATE:___________

Design IIR Chebyshiev filter and compare their performances with different
orders (Low Pass Filter /High Pass Filter).

AIM: To design IIR Chebyshiev filter and compare their performances with different orders
(Low Pass Filter /High Pass Filter).

EQUIPMENTS REQUIRED:
PC with MATLAB Software

PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAM:

clear all; close all;

%IIR/LP
fp=input('Enter the pass band frequency fp = ');
fs=input('Enter the stop band frequency fs = ');
rp=input('Enter the pass band attenuation rp = ');
rs=input('Enter the stop band attenuation rs = ');
f=input ('Enter the sampling frequency = ');
wp=2*fp/f;
ws=2*fs/f;
[n,wn]=cheb1ord(wp,ws,rp,rs);
[b,a]=cheby1(n,0.5,wn,'low');
freqz(b,a,500,f);
title ('Magnitude and phase respose of the IIR butterworth filter');

DEPT. OF ECE, SEAGI Page 33


20A04502P - Digital Signal Processing Lab

INPUTS:
Enter the pass band frequency fp = 20
Enter the stop band frequency fs = 50
Enter the pass band attenuation rp = 1
Enter the stop band attenuation rs = 2
Enter the sampling frequency f =1000
OUTPUT:-

%IIR/HP
clear all; close all;
fp=input('Enter the pass band frequency fp =');
fs=input('Enter the stop band frequency fs = ');
rp=input('Enter the pass band attenuation rp = ');
rs=input('Enter the stop band attenuation rs = ');
f=input ('Enter the sampling frequency f =');
wp=2*fp/f; ws=2*fs/f;
[n,wn]=cheb1ord(wp,ws,rp,rs);
[b,a]=cheby1(n,0.5,wn,'high'); freqz(b,a,500,f);
title('Magnitude and phase response of the IIR chebyshev filter');

DEPT. OF ECE, SEAGI Page 34


20A04502P - Digital Signal Processing Lab

INPUTS:-
Enter the pass band frequency fp = 20
Enter the stop band frequency fs = 50
Enter the pass band attenuation rp = 1
Enter the stop band attenuation rs = 2
Enter the sampling frequency f =1000
OUTPUT:

RESULT:

DEPT. OF ECE, SEAGI Page 35


20A04502P - Digital Signal Processing Lab

EXPERMENT: 10 DATE:___________

Design FIR filter (Low Pass Filter /High Pass Filter) using windowing
technique.
i. Using rectangular window
ii. Using hamming window
iii. Using Kaiser Window
AIM: To design FIR filter (Low Pass Filter /High Pass Filter) using windowing technique.
i. Using rectangular window ii. Using hamming window iii. Using Kaiser window
EQUIPMENTS REQUIRED:
PC with MATLAB Software
PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAMS:
A) rectangular window
clc;
close all;
clear all;
format long;
rp=input('enter the pass band ripple');
rs=input('enter the stop band ripple');
fp=input('enter the pass band frequency');
fs=input('enter the stop band 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;
DEPT. OF ECE, SEAGI Page 36
20A04502P - Digital Signal Processing Lab

y=boxcar(n1);
%Lowpass filter
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,1,1);
plot(o/pi,m);
ylabel ('gain in db---->');
xlabel (‘normalized frequency---->');
title('FIR filter using Rectangular window of LPF ----');
grid on;

%highpass filter

b=fir1(n,wp,’high’, y);

[h,o]=freqz(b,1,256);

m=20*log10(abs(h));

subplot(2,1,2);

plot(o/pi,m);

ylabel('gain in db---->');

xlabel('Normalised frequency---->');

title('FIR filter using Rectangular window of HPF ----');

grid on;

INPUT:-

Enter thepassbandripple 0.04

Enter thestopbandripple 0.05

Enter thepassbandfrequency 1500

Enter the stopband frequency 2000 Enter the sampling frequency 9000

DEPT. OF ECE, SEAGI Page 37


20A04502P - Digital Signal Processing Lab

OUTPUT:

FIR filter using Rectangular window of LPF ----


gain in db----> 50

-50

-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalized frequency---->
FIR filter using Rectangular window of HPF ----
50
gain in db---->

-50

-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency---->

B) hamming window
clear all;
close all;
clc;

n=1000;
fp=300;
fs=1000;
fn=2*fp/fs;

window=hamming(n+1);
b=fir1(n,fn,'low',window);
[h,w]=freqz(b,1,256);

subplot(2,1,1);
plot(w/pi,abs(h));
title('mag response of lpf');
ylabel('gain');
xlabel('normalised freq');

subplot(2,1,2);
plot(w/pi,angle(h));
title('phase response of lpf');
ylabel('angle');
xlabel('normalised freq');
clear all;

DEPT. OF ECE, SEAGI Page 38


20A04502P - Digital Signal Processing Lab

close all;
clc;

n=1000;
fp=300;
fs=1000;
fn=2*fp/fs;

window=hamming(n+1);
b=fir1(n,fn,'high',window);
[h,w]=freqz(b,1,256);

subplot(2,1,1);
plot(w/pi,abs(h));
title('mag response of hpf');
ylabel('gain');
xlabel('normalised freq');

subplot(2,1,2);
plot(w/pi,angle(h));
title('phase response of hpf');
ylabel('angle');
xlabel('normalised freq');

mag response of hpf


1.5

1
gain

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalised freq
phase response of hpf
4

2
angle

-2

-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalised freq

C) Using Kaiser Window


clc;
clearall;
closeall;
rp=input('enter passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter passband freq');

DEPT. OF ECE, SEAGI Page 39


20A04502P - Digital Signal Processing Lab

fs=input('enter stopband freq');


f=input('enter sampling freq ');
beta=input('enter beta value');
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=kaiser(n1,beta);
%Lowpass filter

b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));

subplot(2,1,1);
plot(o/pi,m);
ylabel('gain in db---->');
xlabel('Normalised frequency---->');
title('FIR filter using Kaiser window of LPF ----');
grid on;
%highpass filter
b=fir1(n,wp,’high’,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,1,2);
plot(o/pi,m);
ylabel('gain in db---->');
xlabel('Normalised frequency---->');
title('FIR filter using Kaiser window of HPF ----');
grid on;
INPUT:-
Enter the pass band ripple 0.02

Enter the stop band ripple 0.01

Enter the pass band frequency 1000

Enter the stop band frequency 1500

Enter the sampling frequency 10000

Enter the beta value 5.8

DEPT. OF ECE, SEAGI Page 40


20A04502P - Digital Signal Processing Lab

OUTPUT:

FIR filter using Kaiser window of LPF ----


50

0
gain in db---->

-50

-100

-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency---->
FIR filter using Kaiser window of HPF ----
50

0
gain in db---->

-50

-100

-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency---->

RESULT:

DEPT. OF ECE, SEAGI Page 41


20A04502P - Digital Signal Processing Lab

EXPERMENT: 11 DATE:___________

Design and verify Filter (IIR and FIR) frequency response by using Filter
design and Analysis Tool.

AIM: To design and verify Filter (IIR and FIR) frequency response by using Filter design and
Analysis Tool.

EQUIPMENTS REQUIRED:
PC with MATLAB Software

PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window
PROGRAMS
%BUTTERWORTH LOWPASS FILTER

clear all;
fs=100;
t=(0:100)/fs;
s1=sin(2*pi*t*5);
s2=sin(2*pi*t*20);
s3=sin(2*pi*t*30);
s=s1+s2+s3;
subplot(3,2,3);
plot(t,s);
axis([0 0.5 -3 3]);
DEPT. OF ECE, SEAGI Page 42
20A04502P - Digital Signal Processing Lab

title('test signal');
n=4;
wn=10/50;
[b a]=butter(n,wn);
[h w]=freqz(b,a,512);
subplot(3,2,1);
plot(w*fs/(2*pi),abs(h));
title('butterworth lpf characteristics');
sf=filter(b,a,s);
subplot(3,2,4);
plot(t,sf);
xlabel('time');
ylabel('time waveform');
axis([0 0.5 -1 1]);
title('after filtering in lowpass filter');
s=fft(s,512);
sf=fft(sf,512);
w=(0:255)/256*(fs/2);
subplot(3,2,5);
plot(w,abs(s(1:256)));
xlabel('frequency');
ylabel('F(t)');
title('F(t) of test signal');
subplot(3,2,6);
plot(w,abs(sf(1:256)));
xlabel('frequency');
ylabel('F(t)');

DEPT. OF ECE, SEAGI Page 43


20A04502P - Digital Signal Processing Lab

OUTPUT:

butterworth lpf characteristics


2

0
0 20 40 60

test signal after filtering in lowpass filter

time waveform
1
2
0 0
-2
-1
0 0.1 0.2 0.3 0.4 0 0.1 0.2 0.3 0.4
time
F(t) of test signal
100 50
F(t)

F(t)

50

0 0
0 20 40 60 0 20 40 60
frequency frequency

%'butterworth hpf
clear all;
fs=100;
t=(0:100)/fs;
s1=sin(2*pi*t*5);
s2=sin(2*pi*t*20);
s3=sin(2*pi*t*30);
s=s1+s2+s3;
subplot(3,2,3);
plot(t,s);
axis([0 0.5 -3 3]);
title('test signal');
n=4;
wn=30/50;
[b a]=butter(n,wn,'high');
DEPT. OF ECE, SEAGI Page 44
20A04502P - Digital Signal Processing Lab

[h w]=freqz(b,a,512);
subplot(3,2,1);
plot(w*fs/(2*pi),abs(h));
title('butterworth hpf characteristics');
sf=filter(b,a,s);
subplot(3,2,4);
plot(t,sf);
xlabel('time');
ylabel('time waveform');
axis([0 0.5 -1 1]);
title('after filtering in highpass filter');
s=fft(s,512);
sf=fft(sf,512);
w=(0:255)/256*(fs/2);
subplot(3,2,5);
plot(w,abs(s(1:256)));
xlabel('frequency');
ylabel('F(t)');
title('F(t) of test signal');
subplot(3,2,6);
plot(w,abs(sf(1:256)));
xlabel('frequency');
ylabel('F(t)');

DEPT. OF ECE, SEAGI Page 45


20A04502P - Digital Signal Processing Lab

OUTPUT:

butterworth hpf characteristics


2

0
0 20 40 60

test signal after filtering in highpass filter

time waveform
1
2
0 0
-2
-1
0 0.1 0.2 0.3 0.4 0 0.1 0.2 0.3 0.4
time
F(t) of test signal
100 40
F(t)

F(t)

50 20

0 0
0 20 40 60 0 20 40 60
frequency frequency

RESULTS:

DEPT. OF ECE, SEAGI Page 46


20A04502P - Digital Signal Processing Lab

EXPERMENT: 12 DATE:___________

Compute the Decimation and Interpolation for the given signal.

AIM: To Compute the Decimation and Interpolation for the given signal.

EQUIPMENTS REQUIRED:
PC with MATLAB Software

PROCEDURE:-
• Open MATALB
• Open new M-file
• Type the program
• Save in current directory
• Compile and run the program
• For the output see the command window / figure window

PROGRAMS
%DECIMATION
clc;
clear all;
close all;
N=250 ;
n=0:1:N-1;
x=sin(2*pi*n/15);
M=2;
figure(1)
stem(n,x);
grid on;
xlabel('No.of.Samples');
ylabel('Amplitude');
title('Original Sequence');
DEPT. OF ECE, SEAGI Page 47
20A04502P - Digital Signal Processing Lab

a=1;
b=fir1(5,0.5,'Low');
y=filter(b,a,x);
figure(2)
stem(n,y);
grid on;
xlabel('No.of.Samples');
ylabel('Amplitude');
title('Filtered Sequence');
Date:………… DSP Lab Manual ………
Turbomachinery Institute of Technology & Sciences, Hyd. 319
x1=y(1:M:N);
n1=1:1:N/M;
figure(3)
stem(n1-1,x1);
grid on;
xlabel('No.of.Samples');
ylabel('Amplitude');
title('Decimated Sequence');

DEPT. OF ECE, SEAGI Page 48


20A04502P - Digital Signal Processing Lab

OUTPUTS:

Original Sequence
1

0.8

0.6

0.4

0.2
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 50 100 150 200 250
No.of.Samples

Original sequence
Filtered Sequence
1

0.8

0.6

0.4

0.2
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 50 100 150 200 250
No.of.Samples

Filtered sequence

DEPT. OF ECE, SEAGI Page 49


20A04502P - Digital Signal Processing Lab

Decimated Sequence
1

0.8

0.6

0.4

0.2
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 20 40 60 80 100 120 140
No.of.Samples

Decimated sequence
%INTERPOLATION
clc;
clear all;
close all;
N=125;
n=0:1:N-1;
x=sin(2*pi*n/15);
L=2;
figure(1)
stem(n,x);
grid on;
xlabel('No.of.Samples');
ylabel('Amplitude');
title('Original Sequence');
x1=[zeros(1,L*N)];
n1=1:1:L*N;
j =1:L:L*N;

DEPT. OF ECE, SEAGI Page 50


20A04502P - Digital Signal Processing Lab

x1(j)=x;
figure(2)
stem(n1-1,x1);
grid on;
xlabel('No.of.Samples');
ylabel('Amplitude');
title('Upsampled Sequence');
a=1;
b=fir1(5,0.5,'Low');
y=filter(b,a,x1);
figure(3)
stem(n1-1,y);
grid on;
xlabel('No.of.Samples');
ylabel('Amplitude');
title('Interpolated Sequence');
OUTPUT:

Original Sequence
1

0.8

0.6

0.4

0.2
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 20 40 60 80 100 120 140
No.of.Samples

Original sequence

DEPT. OF ECE, SEAGI Page 51


20A04502P - Digital Signal Processing Lab

Upsampled Sequence
1

0.8

0.6

0.4

0.2
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 50 100 150 200 250
No.of.Samples

Filtered sequence
Interpolated Sequence
0.5

0.4

0.3

0.2

0.1
Amplitude

-0.1

-0.2

-0.3

-0.4

-0.5
0 50 100 150 200 250
No.of.Samples

Interpolated sequence

DEPT. OF ECE, SEAGI Page 52


20A04502P - Digital Signal Processing Lab

RESULTS :

Code Composure Studio

DEPT. OF ECE, SEAGI Page 53


20A04502P - Digital Signal Processing Lab

EXPERMENT: 1 DATE:___________
TMS320C6x DIGITAL SIGNAL PROCESSOR
INTRODUCTION
The TMS320C6713 (C6713) is based on the VLIW architecture, which is very well suited for numerically
intensive algorithms. The internal program memory is structured so that a total of eight instructions can be
fetched every cycle. For example, with a clock rate of 225MHz, the C6713 is capable of fetching eight 32-
bit instructions every 1/(225 MHz) or 4.44 ns. Features of the C6713 include 264 kB of internal memory
(8kB as L1P and L1D Cache and 256kB as L2 memory shared between program and data space), eight
functional or execution units composed of six arithmetic-logic units (ALUs) and two multiplier units, a
32-bit address bus to address 4 GB (gigabytes), and two sets of 32-bit general-purpose registers.
The C67xx (such as the C6701, C6711, and C6713) belong to the family of the C6x floating-point
processors, whereas the C62xx and C64xx belong to the family of the C6x fixed-point processors. The
C6713 is capable of both fixed- and floating point processing.

An application-specific integrated circuit (ASIC) has a DSP core with customized circuitry for a
specific application. A C6x processor can be used as a standard general-purpose DSp programmed for a
specific application. Specific-purpose digital signal processors are the modem, echo canceler, and others.
A fixed-point processor is better for devices that use batteries, such as cellular phones, since it uses less
power than does an equivalent floating-point processor. The fixed-point processors, C1x, C2x, and C5x,
are 16-bit processors with limited dynamic range and precision. The C6x fixed-point processor is a 32-bit
processor with improved dynamic range and precision. In a fixed-point processor, it is necessary to scale
the data. Overflow, which occurs when an operation such as the addition of two numbers produces a result
with more bits than can fit within a processor’s register, becomes a concern.
A floating-point processor is generally more expensive since it has more “real estate” or is a larger
chip because of additional circuitry necessary to handle integer as well as floating-point arithmetic.
Several factors, such as cost, power consumption, and speed, come into play when choosing a specific
DSp. The C6x processors are particularly useful for applications requiring intensive computations. Family
members of the C6x include both fixed-point (e.g., C62x, C64x) and floating-point (e.g., C67x)
processors. Other DSp’s are also available from companies such as Motorola and Analog Devices.

DEPT. OF ECE, SEAGI Page 54


20A04502P - Digital Signal Processing Lab

TMS320C6X ARCHITECTURE

Figure 1: Functional block diagram of TMS320C6713

The TMS320C6713 onboard the DSK is a floating-point processor based on the VLIW architecture [6–
10]. Internal memory includes a two-level cache architecture with 4 kB of level 1 program cache (L1P), 4
kB of level 1 data cache (L1D), and 256 kB of level 2 memory shared between program and data space. It
has a glueless (direct) interface to both synchronous memories (SDRAM and SBSRAM) and
asynchronous memories (SRAM and EPROM). Synchronous memory requires clocking but provides a
compromise between static SRAM and dynamic DRAM, with SRAM being faster but more expensive
than DRAM. On-chip peripherals include two McBSPs, two timers, a host port interface (HPI), and a 32-
bit EMIF. It requires 3.3 V for I/O and 1.26 V for the core (internal). Internal buses include a 32-bit
program address bus, a 256-bit program data bus to accommodate eight 32-bit instructions, two 32-bit
data address buses, two 64-bit data buses, and two 64-bit store data buses. With a 32-bit address bus, the
total memory space is 232 = 4GB, including four external memory spaces: CE0, CE1, CE2, and CE3.
Figure shows a functional block diagram of the C6713 processor included with CCS.

DEPT. OF ECE, SEAGI Page 55


20A04502P - Digital Signal Processing Lab

TMS320C6X- PROCEDURE FOR USING C60 DEBUGGER

Step1: Open → 6177 Diagnostic → start → Stop → Close

Step 2: Project → New → Project Name → Target → TMS320C67XX

DEPT. OF ECE, SEAGI Page 56


20A04502P - Digital Signal Processing Lab

Step 3: Libraries → Add Files to Project → My Project → C600 → CG Tools →


Library → rts6700.lib

Step 4: File → New → Source File → Write Program in window

DEPT. OF ECE, SEAGI Page 57


20A04502P - Digital Signal Processing Lab

Step 5: File → Save as →CStudio→ my project →sss.c

Step 6: Source → Add Files to project →CStudio→ lib →confi.c

DEPT. OF ECE, SEAGI Page 58


20A04502P - Digital Signal Processing Lab

Step 7: Source → Add Files to Project →CStudio→ C600 → Tutorial →


Dsk6713 → hello1 → link cmd→ hello.cmd

Step 8: Project → Compile File

DEPT. OF ECE, SEAGI Page 59


20A04502P - Digital Signal Processing Lab

Step 9: Project → Build all

Step 10: File → Load Program → Debug → Output File

DEPT. OF ECE, SEAGI Page 60


20A04502P - Digital Signal Processing Lab

Step 11: Debug → Run

Step 12: Veiw→ Graph → Time/Frequency

Step 13: Start Address ‘a’ and DSP data type- 32 bit floating point

DEPT. OF ECE, SEAGI Page 61


20A04502P - Digital Signal Processing Lab

Step 14: We will get th required output ………..!!!!!

DEPT. OF ECE, SEAGI Page 62


20A04502P - Digital Signal Processing Lab

EXPERMENT: 2 DATE:___________

Convolution of discrete sequence without using built in functions for convolutions


operations

AIM: To write a CC STUDIO Program for finding the Convolution of discrete sequence without
using built in functions for convolutions operations.

EQUIPMENTS REQUIRED:
PC with C. C STUDIO

Program:
/*linear convolution*/
#include<stdio.h>
int x[15],h[15],y[15];
main()
{
int i,j,m,n;
printf("\n enter value for m");
scanf("%d",&m);
printf("\n enter value for n");
scanf("%d",&n);
printf(" enter value for i/p x(n):\n");
for(i=0;i<m;i++)
scanf("%d",&x[i]);
printf("enter values for i/p h(n) \n");
for(i=0;i<n;i++)
scanf("%d",&h[i]);
//Padding of zeros
for(i=m;i<=m+n-1;i++)

DEPT. OF ECE, SEAGI Page 63


20A04502P - Digital Signal Processing Lab

x[i]=0;
for(i=n;i<=m+n-1;i++)
h[i]=0;
/*convolution operation*/
for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
{
y[i]=y[i]+(x[i]*h[i-j]);
}}
//displaying the output
for(i=0;i<m+n-1;i++)
printf("\n the value of output y[%d]=%d",i,y[i]);
}

/* program to implement circular convolution */


#include<stdio.h>
int m,n,x[30],h[30],y[30],i,j,k,x2[30],a[30];
void main()
{
printf("enter the length of the first sequence\n");
scanf("%d",&m);
printf("enter the length of the second sequence\n");
scanf("%d",&n);
printf("enter the first sequence\n");
for(i=0;i<m;i++)
scanf("%d",&x[i]);

DEPT. OF ECE, SEAGI Page 64


20A04502P - Digital Signal Processing Lab

printf("enter the second sequence\n");


for(j=0;j<n;j++)
scanf("%d",&h[j]);
if(m-n!=0)/*if length of both sequences are not equal*/
{
if (m>n)/*pad the smaller sequences with zero*/
{
for(i=n;i<m;i++)
h[i]=0;
n=m;
}
for(i=m;i<n;i++)
x[i]=0;
m=n;
}
y[0]=0;
a[0]=h[0];
for(j=1;j<n;j++)/*folding h(n) to h(-n)*/
a[j]=h[n-j];
/*circular convolution*/
for(i=0;i<n;i++)
y[0]+=x[i]*a[i];
for(k=1;k<n;k++)
{
y[k]=0;
/*circular shift*/
for(j=1;j<n;j++)
x2[j]=a[j-1];
x2[0]=a[n-1];

DEPT. OF ECE, SEAGI Page 65


20A04502P - Digital Signal Processing Lab

for(i=0;i<n;i++)
{
a[i]=x2[i];
y[k]+=x[i]*x2[i];
}
}/*displaying the result*/
printf("the circular convolution is\n");
for(i=0;i<n;i++)printf("%d\t",y[i]);
}
OUTPUT:
enter value for m4
enter value for n4
Enter values for i/p
1234
Enter Values for n
1234
The Value of output y[0]=1
The Value of output y[1]=4
The Value of output y[2]=10
The Value of output y[3]=20
The Value of output y[4]=25
The Value of output y[5]=24
The Value of output y[6]=16

DEPT. OF ECE, SEAGI Page 66


20A04502P - Digital Signal Processing Lab

OUTPUT:-
Enter the length of the first sequence
4
Enter the length of the second sequence
3
Enter the first sequence
1234
Enter the second sequence
123
The circular convolution is
18 16 10 16

DEPT. OF ECE, SEAGI Page 67


20A04502P - Digital Signal Processing Lab

DEPT. OF ECE, SEAGI Page 68


20A04502P - Digital Signal Processing Lab

EXPERMENT: 3 DATE:___________

Design of FIR filter using windowing technique and verify the frequency response of the filter.

AIM: To design FIR filter using windowing technique and verify the frequency

response of the filter.

EQUIPMENTS REQUIRED:
PC with C. C STUDIO

PROGRAM:
#include<stdio.h>
#include<math.h>
#define pi 3.1415
int n,N,c;
float wr[64],wt[64];
void main()
{
printf("\n enter no. of samples,N= :");
scanf("%d",&N);
printf("\n enter choice of window function\n 1.rect \n 2. triang \n c= :");
scanf("%d",&c);
printf("\n elements of window function are:");
switch(c)
{
case 1:
for(n=0;n<=N-1;n++)
{
wr[n]=1;
printf(" \n wr[%d]=%f",n,wr[n]);
}
break;
case 2:

DEPT. OF ECE, SEAGI Page 69


20A04502P - Digital Signal Processing Lab

for(n=0;n<=N-1;n++)
{
wt[n]=1-(2*(float)n/(N-1));
printf("\n wt[%d]=%f",n,wt[n]);
}
break;
}}
OUTPUT:
Rectangular window:

DEPT. OF ECE, SEAGI Page 70


20A04502P - Digital Signal Processing Lab

Triangular window:

RESULT:

DEPT. OF ECE, SEAGI Page 71


20A04502P - Digital Signal Processing Lab

EXPERMENT: 4 DATE:___________

Design of IIR filter using any of the available methods and verify the frequency response of
the filter

AIM: To design an IIR filter using any of the available methods and verify the frequency
response of the filter.

EQUIPMENTS REQUIRED:
PC with C. C STUDIO

Program:
//IIR FILTERS USING C
#include<stdio.h>
#include<math.h>
int i,w,wc,c,N;
float H[100];
float mul(float, int);
void main()
{
printf("\n enter order of filter ");
scanf("%d",&N);
printf("\n enter the cutoff freq ");
scanf("%d",&wc);
printf("\n enter the choice for IIR filter 1. LPF 2.HPF ");
scanf("%d",&c);
switch(c)
{
case 1:
for(w=0;w<100;w++)
{
H[w]=1/sqrt(1+mul((w/(float)wc),2*N));
printf("H[%d]=%f\n",w,H[w]);
}
break;

DEPT. OF ECE, SEAGI Page 72


20A04502P - Digital Signal Processing Lab

case 2:
for(w=0;w<=100;w++)
{
H[w]=1/sqrt(1+mul((float)wc/w,2*N));
printf("H[%d]=%f\n",w,H[w]);
}
break;
}}
float mul(float a,int x)
{
for(i=0;i<x-1;i++)
a*=a;
return(a);
}
OUTPUT:
IIR FILTER (LPF )

DEPT. OF ECE, SEAGI Page 73


20A04502P - Digital Signal Processing Lab

IIR FILTER (HPF)

RESULT:

DEPT. OF ECE, SEAGI Page 74

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