0% found this document useful (0 votes)
0 views

Dsp Lab Modified Manual

The document is a manual for the Digital Signal Processing Laboratory at Gayatri Vidya Parishad College, detailing lab procedures, course objectives, and outcomes. It outlines specific experiments to be conducted using MATLAB and DSP processors, emphasizing the importance of punctuality, group work, and proper documentation. The manual also includes theoretical concepts, source code examples, and guidelines for conducting experiments effectively.

Uploaded by

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

Dsp Lab Modified Manual

The document is a manual for the Digital Signal Processing Laboratory at Gayatri Vidya Parishad College, detailing lab procedures, course objectives, and outcomes. It outlines specific experiments to be conducted using MATLAB and DSP processors, emphasizing the importance of punctuality, group work, and proper documentation. The manual also includes theoretical concepts, source code examples, and guidelines for conducting experiments effectively.

Uploaded by

uppadamohan408
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

SCHOOL OF ENGINEERING
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND PG COURSES
Approved by AICTE, Permanently Affiliated to Andhra University
Rushikonda, Visakhapatnam-530 045

Manual for DIGITAL SIGNAL PROCESSING Laboratory


LAB CODE

1. Students should report to the concerned labs as per the time table schedule.
2. Students who turn up late to the labs will in no case be permitted to perform the
experiment scheduled for the day.
3. Students should bring a note book of about 100 pages and should enter the
readings/observations into the note book while performing the experiment.
4. After completion of the experiment, certification of the concerned staff in-charge in the
observation book is necessary.
5. The record of observations along with the detailed procedure of the program executed in
the immediate last session should be submitted and certified by the staff member in-
charge
6. Not more than three students in a group are permitted to execute the program on a setup.
7. The group-wise division made in the beginning should be adhered to, and no mix up of
student among different groups will be permitted later.
8. The trainer required should be collected from stores in-charge after duly filling in the
requisition form.
9. When the program is executed, students should disconnect the setup made by them, and
should return all the components/instruments taken for the purpose. Any damage of the
trainer or burn-out of components will be viewed seriously either by putting penalty or by
dismissing the total group of students from the lab for the semester/year.
10. Students should be present in the labs for the total scheduled duration.
11. Students are required to prepare thoroughly to execute the program coming to
Laboratory. Procedure sheets/data sheets provided to the students’ groups should be
maintained neatly and to be returned after the execution.
COURSE OBJECTIVES:

i. To generate the elementary signals/ waveforms.

ii. To Calculate and Plot DFT / IDFT of given DT signal and prove it theoretical.

iii. To plot frequency response of a given LTI system.

iv. To Implement FFT of a given sequence.

v. To determine and plot the Power Spectrum of a given signal(s).

vi. To Plot Magnitude and Phase of LP FIR filter for any given sequence.

vii. To Plot Magnitude and Phase of HP FIR filter for a given sequence.

viii. Plot Magnitude and Phase of LP IIR filter for a given sequence.

ix. To Plot Magnitude and Phase of HP IIR filter for a given sequence.

x. To generate Sinusoidal signal through filtering.

xi. To Implement Decimation Process of any given sequence.

xii. To Implement Interpolation Process of any given sequence.

xiii. To Implement I/D sampling rate converters.

xiv. To plot a time and frequency display of microphone plus a cosine using DSP.

xv. To plot Impulse response of first order and second order systems.

COURSE OUTCOMES:

i. CO1: The student will be able to carry out simulation of DSP systems.

ii. CO2: The student will be able to demonstrate their abilities towards DSP processor based

Implementation of DSP systems.

iii. CO3: The student will be able to analyze Finite word length effect on DSP systems.

iv. CO4: The student will be able to demonstrate the applications of FFT to DSP.

v. CO5: The student will be able to implement adaptive filters for various applications of DSP.
ECE 3208 DSP LABORATORY

Periods Exam Sessional Exam Total


Credits
Theory Tutorial Lab Hrs. Marks Marks Marks
2 - - 3 3 50 50 100

LIST OF EXPERIMENTS

Cycle: 1

MAT LAB EXPERIMENTS:


1. GENERATION OF DISCRETE –TIME SEQUENCES
2. IMPLEMENTATION OF DISCRETE TIME SYSTEMS
a) LINEAR CONVOLUTION OF TWO SEQUENCES
b) CIRCULAR CONVOLUTION OF TWO SEQUENCES
3. FREQUENCY ANALYSIS OF DISCRETE TIME SEQUENCES
4. FREQUENCY ANALYSIS OF DISCRETE TIME SYSTEMS
5. DESIGN OF IIR DIGITAL FILTER
a) BUTTERWORTH
b) CHEBYSHEV
6. DESIGN OF FIR DIGITAL FILTER
7. DESIGN OF FIR DIGITAL FILTER
a) HAMMING WINDOW
b) RECTANGULAR WINDOW
Cycle: 2

HARDWARE EXPERMENTS:
1. VERIFICATION OF LINEAR CONVOLUTION USING DSP PROCESSOR KIT
2. VERIFICATION OF CIRCULAR CONVOLUTION USING DSP PROCESSOR
KIT
3. IMPLEMENTATION OF IIR FILTERS ON DSP PROCESSOR
4. IMPLEMENTATION OF FIR FILTERS USING WINDOW TECHNIQUES ON
DSP PROCESSOR
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 1
1.1 TITLE: GENERATION OF CONTINUOUS AND DISCRETE –TIME SEQUENCES

1.2 OBJECTIVES:
i. To generate continuous and discrete time signals

1.3 EQUIPMENT REQUIRED:

i. MATLAB software

ii. Personal Computer

1.4 THEORY:
1 for t = 0
i. UNIT IMPULSE SIGNAL/SEQUENCE:  (t ) = 
0 otherwise

ii. UNIT STEP SIGNAL:


1 fort  0
u (t ) = 
0 fort  0
iii. EXPONENTIAL SIGNAL:

iv. UNIT RAMP SIGNAL:

v. SINUSOIDAL SIGNAL:
vi. RANDOM SIGNAL:

1.5 SOURCE CODE:

FOR CONTINOUS TIME:

clc;
clear all;
close all;
T1=-3:1:3;
x1=[0,0,0,1,0,0,0];
subplot(2,3,1);
stem(T1,x1);
xlabel('time');
ylabel('amplitude');
title('unit impulse signal');
%UNIT STEP SEQUENCE
T2=-10:1:20;
x2=[zeros(1,5),ones(1,26)];
subplot(2,3,2);
stem(T2,x2);
xlabel('time');
ylabel('amplitude');
title('unit step signal');
%EXPONENTUIAL SEQUENCE
a=input('enter the value of a:');
T3=-10:1:20;
x3=exp(-1*a*n3);
subplot(2,3,3);
plot(T3,x3);
xlabel('time');
ylabel('amplitude');
title('exponential signal');
%UNIT RAMP SEQUENCE
T4=-10:7:20;
x4=n4;
subplot(2,3,4);
stem(T4,x4);
xlabel('time');
ylabel('amplitude');
title('ramp signal');
%UNIT SINUSOIDAL SEQUENCE
b=input('enter the amplitude:');
f=input('enter the frequency:');
T5=-10:0.9:10;
x5=b*sin(2*pi*f*n5);
subplot(2,3,5);
stem(T5,x5);
xlabel('time');
ylabel('amplitude');
title('sinusoidal signal');
%RANDOM SEQUENCE
T6=-10:1:20;
x6=rand(1,31);
subplot(2,3,6);
plot(T6,x6);
xlabel('time');
ylabel('ampiltude');
title('random signal');
FOR DISCRETE TIME:
clc;
clear all;
close all;
n1=-3:1:3;
x1=[0,0,0,1,0,0,0];
subplot(2,3,1);
stem(n1,x1);
xlabel('time');
ylabel('amplitude');
title('unit impulse sequence');
%UNIT STEP SEQUENCE
n2=-10:1:20;
x2=[zeros(1,5),ones(1,26)];
subplot(2,3,2);
stem(n2,x2);
xlabel('time');
ylabel('amplitude');
title('unit step sequence');
%EXPONENTUIAL SEQUENCE
a=input('enter the value of a:');
n3=-10:1:20;
x3=exp(-1*a*n3);
subplot(2,3,3);
plot(n3,x3);
xlabel('time');
ylabel('amplitude');
title('exponential sequence');
%UNIT RAMP SEQUENCE
n4=-10:7:20;
x4=n4;
subplot(2,3,4);
stem(n4,x4);
xlabel('time');
ylabel('amplitude');
title('ramp sequence');
%UNIT SINUSOIDAL SEQUENCE
b=input('enter the amplitude:');
f=input('enter the frequency:');
n5=-10:0.9:10;
x5=b*sin(2*pi*f*n5);
subplot(2,3,5);
stem(n5,x5);
xlabel('time');
ylabel('amplitude');
title('sinusoidal SEQUENCE');
%RANDOM SEQUENCE
n6=-10:1:20;
x6=rand(1,31);
subplot(2,3,6);
plot(n6,x6);
xlabel('time');
ylabel('ampiltude');
title('random sequence');

MODEL GRAPH:
PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.
1.6 ERRORS:
No Errors
1.7 RESULT:
The continuous-time signals and discrete-time sequences Are generated.
1.8 ANALYSIS:
In both the continuous and discrete signals the amplitude is continuous but the time is
continuous in continuous and discrete in discrete time signals/sequences.
1.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.

1.10 CONCLUSION:
Therefore the continuous time and discrete time signals/sequences are generated using
mat lab.

VIVA-VOCE QUESTIONS:
i. Define impulse signal
ii. Define ramp signal
iii. Define unit step signal
iv. Define exponential signal
v. Define sinusoidal signal
vi. Define C.T.S
vii. Define D.T.S.
viii. Compare C.T.S & D.T.S
ix. Define Stem, Plot, Plot3,fplot, ezplot, linspace, flyplr, grid,mesh and legend
x. Draw the C.T.S & D.T.S diagrams
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 2
2.1 TITLE: IMPLEMENTATION OF DISCRETE TIME SYSTEMS
i. LINEAR CONVOLUTION OF TWO SEQUENCES
ii. CIRCULAR CONVOLUTION OF TWO SEQUENCES
iii. LINEAR CONVOLUTION USING CIRCULAR CONVOLUTION METHOD.
2.2 OBJECTIVE:
i. To perform linear convolution, circular convolution, linear convolution using circular
convolution between two input sequences x1={1,2,3,4} and x2={2,3,4,5} .
2.3 SOFTWARE REQUIRED:

i. MATLAB software
ii. Personal Computer
2.4 THEORY:
1. linear convolution :it is the basic operation to calculate the output for any linear time
invariant system given its input and its impulse response. e.g: x1={1,2,3,4} ;
x2={2,3,4,5}

2 3 4 5
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20

Ans: F={2,7,16,30,34,31,20}
2. circular convolution method: it is the basic operation of a two periodic function occurs
when one of them is convolued in the normal way with a periodic summation of the other
function.
e.g: x1={1,2,3,4} ; x2={2,3,4,5}
1 4 3 2 2 36
2 1 4 3 3 = 38
3 2 1 4 4 36
4 3 2 1 5 30

Ans: f={36,38,36,30}
3. linear convolution using circular convolution:
i. Linear convolution is the basic operation to calculate the output for
any linear time invariant system given its input and its impulse response.
ii. Circular convolution is the same thing but considering that the support of the
signal is periodic.(it is done using matrix multiplication method)
iii. It has a length of n=L+m-1 sequences.

e.g: x1={1,2,3,4} ; x2={2,3,4,5}


Where L=4 for input sequence 1. M=4 for input sequence 2 .
N=L+m-1=4+4-1=7 (zero padding).
The resultant input sequences are:
X1={1,2,3,4,0,0,0) ; X2={2,3,4,5,0,0,0}

y(n)={2,7,16,30,34,31,20}
2.5 SOURCE CODE:
I. LINEAR CONVOLUTION :
clc;
clear all;
close all;
x1=input('enter first sequence');
l1=length(x1);
n1=0:1:l1-1;
subplot(2,2,1);
stem(n1,x1);
xlabel('n1');
ylabel('x(n1)');
title('input sequence 1');
x2=input('enter the second sequence');
l2=length(x2);
n2=0:1:l2-1;
subplot(2,2,2);
stem(n2,x2);
xlabel('n2');
ylabel('h(n)');
title('input sequence 2');
y=conv(x1,x2);
disp('linear convolution of given 2 inputs is :');
disp(y);
n=0:1:length(y)-1;
subplot(2,1,2);
stem(n,y);
xlabel('n');
ylabel('y(n)');
title(' linear convolution of x1(n),x2(n)');

II. CIRCULAR COVOLUTION:


clc;
clear all;
close all;
x1=input('enter first sequence');
l1=length(x1);
n1=0:1:l1-1;
subplot(2,2,1);
stem(n1,x1);
xlabel('n1');
ylabel('x(n1)');
title('input sequence 1');
x2=input('enter the second sequence');
l2=length(x2);
n2=0:1:l2-1;
subplot(2,2,2);
stem(n2,x2);
xlabel('n2');
ylabel('h(n)');
title('input sequence 2');
y=cconv(x1, x2, max (l1, l2));
disp('circular convolution of given 2 inputs is :');
disp(y);
n=0:1:length(y)-1;
subplot(2,1,2);
stem(n,y);
xlabel('n');
ylabel('y(n)');
title(' circular convolution of x1(n),x2(n)');

III. LINEAR USING CIRCULAR CONVOLUTION:


clc;
clear all;
close all;
x1=input('enter first sequence');
l1=length(x1);
n1=0:1:l1-1;
subplot(2,2,1);
stem(n1,x1);
xlabel('n1');
ylabel('x(n1)');
title('input sequence 1');
x2=input('enter the second sequence');
l2=length(x2);
n2=0:1:l2-1;
subplot(2,2,2);
stem(n2,x2);
xlabel('n2');
ylabel('h(n)');
title('input sequence 2');
if l1>l2
l3=l1-l2;
x2=[x2,zeros(1,l3)];
elseif l2>l1
l3=l2-l1;
x1=[x1,zeros(1,l3)];
end
n=l1+l2-1;
y=cconv(x1,x2,n);
disp('linear convolution using circular of given 2 inputs is :');
disp(y);
n=0:1:length(y)-1;
subplot(2,1,2);
stem(n,y);
xlabel('n');
ylabel('y(n)');
title(' linear convolution of x1(n),x2(n)');

MODEL GRAPHS:
PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.

2.6 ERRORS:
No Errors
2.7 RESULT:
The linear, circular, and linear using circular convolution methods are performed for
given two input sequences.
2.8 ANALYSIS:
In both the continuous and discrete signals the amplitude is continuous but the time is
continuous in continuous and discrete in discrete time signals/sequences.
2.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.

2.10 CONCLUSION:
Hence for two input sequences the corresponding linear convolution,circular convolution,
linear convolution using circular convolution are plotted using Mat lab.
VIVA-VOCE QUESTIONS:
i. Differentiate between linear and circular convolution.
ii. Determine the unit step response of the linear time invariant system with impulse
response h(n)=a n u(n) a<1&-a<1
iii. Determine the range of values of the parameter a for which linear time invariant system
with impulse response h(n)=a n u(n) is stable.
iv. Consider the special case of a finite duration sequence given as X(n)={2 4 0 3}, resolve
the sequence x(n) into a sum of weighted sequences.
v. Describe impulse response of a function?
vi. Where to use command filter or impz, and what is the difference between these two?
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 3
3.1 TITLE: FREQUENCY ANALYSIS OF DISCRETE TIME SEQUENCES.
3.2 OBJECTIVE:
i. To find the N-point DFT of a given sequence using Fast Fourier Transform (FFT).

3.3 SOFTWARE REQUIRED:

i. MATLAB software
ii. Personal Computer
3.4 THEORY:
A fast Fourier transform (FFT) is an algorithm that samples a signal over a period of
time (or space) and divides it into its frequency components.These components are single
sinusoidal oscillations at distinct frequencies each with their own amplitude and phase. This
transformation is illustrated in Diagram 1. Over the time period measured in the diagram, the
signal contains 3 distinct dominant frequencies. The N-point DFT of any signal x[n] is defined
as follows: X[k] 4 = PN−1 n=0 x[n] e − 2π N kn, k = 0, . . . , N − 1 ?? otherwise. Almost all
books agree on the top part of this definition. (An exception is the 206 textbook (DSP First),
which includes a 1 N out front to make the DFT match the DTFS.)But there are several possible
choices for the “??” part of this definition. 1. Treat X[k] as an N-periodic function that is
defined for all integer arguments k ∈ Z. This is reasonable mathematically since X[n + N] = N
X−1 n=0 x[n] e − 2π N (k+N)n = N X−1 n=0 x[n] e − ( 2π N kn+2πkn) = N X−1 n=0 x[n] e
− 2π N kn = X[k] . 2. Treat X[k] as undefined for k ∈/ {0, . . . , N − 1}. This is reasonable
from a practical perspective since in a computer we have subroutines that take an N-point signal
x[n] and return only the N values X[0], . . . , X[N − 1], so trying to evaluate an expression like
“X[−k]” will cause an error in a computer. 3. Treat X[k] as being zero for k ∈/ {0, . . . , N − 1}.
This is a variation on the previous option. The book seems to waver somewhat between the first
two conventions. These lecture notes are based on the middle convention: that the N-point DFT
is undefined except for k ∈ {0, . . . , N − 1}. This choice is made because it helps prevent
computer programming errors.
3.5 SOURCE CODE:
Clc;
x1=input('enter the sequence');
n=input('enter the length');
m=fft(x1,n);
y = abs(m);
disp(‘N-Point DFT of a given sequence’);
disp(y);
N = 0:1:n-1;
subplot(2,2,1);
stem(N,y);
xlabel(‘length’);
ylabel(‘magnitude of DFT of x(k)’);
title(‘magnitude spectrum’);
an = angle(‘m’);
subplot(2,2,2);
stem(N,an);
ylabel('phase of DFT of x(n)');
xlabel(‘length');
title(‘phase spectrum’);
MODEL GRAPH:
PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.
3.6 ERRORS:
No Errors
3.7 RESULT:
Thus N-point DFT of given sequence is simulated in MATLAB.

3.8 ANALYSIS:
In the discrete time signals the amplitude is continuous but the time is continuous in
continuous and discrete in discrete time sequences.
3.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.
3.10 CONCLUSION:
Hence the discrete time sequences are generated using Matlab and plotted using Mat lab.
VIVA-VOCE QUESTIONS:

i. How to calculate output of DFT using MATLAB?


ii. Where DFT is used?
iii. What is the difference between DFT and IDFT?
iv. How to compute maximum length N for a circular convolution using DFT and
IDFT.(what is command).
v. Explain the function of twiddle factor?
vi. Give the practical application DFT & IDFT?
vii. Explain the role of DFT & IDFT when the signal converted from the time domain to
frequency domain?
viii. Differentiate between time variant and time invariant system. If x 1(n)={1,2,3,4} and x
2(n)={1,2,3} Find the convolution using tabular representation.
ix. Draw all elementary standard discrete time signals.
x. Differentiate between causal and Non causal system.
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 4
4.1 TITLE: FREQUENCY ANALYSIS OF DISCRETE TIME SYSTEMS.
4.2 OBJECTIVE:
i. To find the impulse response of a system with the transfer function
y(n)+1/2y(n-1)+1/3y(n-2)=x(n)

4.3 SOFTWARE REQUIRED:

i. MATLAB software
ii. Personal Computer
4.4 THEORY:
In signal processing, the impulse response or impulse response of a dynamic system is its
output when presented with a brief input signal, called an impulse. More generally, an
impulse response is the reaction of any dynamic system in response to some external
change.
4.5 SOURCE CODE:
clc;
b=[1];
a=[1;1/2;1/3];
h=impz(a,b,4);
disp('impulse response h(n)');
disp(h);
n1=0:1:length(h)-1;
subplot(3,2,1);
stem(n1,h);
xlabel('n1');
ylabel('x(n)');
title('impulse response h(n)');
x=[1,2];
y=conv(h,x);
disp('output y(n)');
disp(y);
n2=0:1:length(y)-1;
subplot(3,2,2);
stem(n2,y);
xlabel('n2');
ylabel('amplitude');
title('outputy(n)');

MODEL GRAPHS:-

PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.

4.6 ERRORS:
No Errors
4.7 RESULT:
The impulse response of a system with the transfer function is obtained.

4.8 ANALYSIS:
The impulse response of a given dynamic system for a given input sequence,the
corresponding response h(n) and output y(n) is obtained.
4.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.
4.10 CONCLUSION:
Hence the impulse response of a system is determined and graphs of response h(n) and
output y(n) are plotted using mat lab.

VIVA-VOCE QUESTIONS:
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 5
5.1 TITLE:DESIGN OF IIR DIGITAL FILTER
i. BUTTERWORTH
ii. CHEBYSHEV
5.2 OBJECTIVE:
i. To design IIR Butterworth Band pass, Band stop, low pass, high pass filter.
ii. To design IIR chebyschev type-1low pass, high pass, band pass and band reject
filter.
5.3 SOFTWARE REQUIRED:

iii.MATLAB software
iv.Personal Computer
5.4 THEORY:
i.BUTTERWORTH:
Band pass filter: It is an electronic device or circuit that allows signals between two specific
frequencies to pass that discriminates against signals at other frequencies.
Band stop filter: In signal processing, a band stop filter or band reject filter is a filter that
passes most of the frequencies but attenuates those in a specific range of values to very low
levels. It is the opposite of band pass filter. A notch filter is a band stop filter with a narrow stop
band ( high Q -factor) used in line sound reproduction ,instrument amplifier etc.
Design of butter worth analog filter procedure –
i) Find the order ‘N’ of the filter from the given specifications
N = 1/2 log[(10^0.1αs–1)/(10^0.1αp–1)] / log(Ωs/Ωp)
(or) N = log(λ/ϵ) / log(Ωs/Ωp)
ii) Round off the N value to the next higher integer.
iii) Find the transfer function H(s) for ‘Ωc =1 ‘ for the value N.
iv) Calculate the value of ‘Ωc’ .
Ωc = Ωp /(10^0.1 αp-1)^1/2N
Ωc = Ωs /(10^0.1 αs-1)^1/2N
v) Find the value of final transfer function for the above value ‘Ωc’ by substituting
S = S / Ωc (LPF) S = Ωc / S (HPF)

ii. CHEBYSHEV:
Band pass filter: It is an electronic device or circuit that allows signals between two specific
frequencies to pass that discriminates against signals at other frequencies .
Band stop filter: In signal processing, a band stop filter or band reject filter is a filter that
passes most of the frequencies but attenuates those in a specific range of values to very low
levels. It is the opposite of band pass filter. A notch filter is a band stop filter with a narrow stop
band ( high Q -factor) used in line sound reproduction ,instrument amplifier etc.
IIR is a recursive type of filter that means output depends upon present, past inputs and past
outputs. Design procedure for chebyschev filter
5.5 SOURCE CODE:
i. BUTTERWORTH
%butterworth band pass filter

clc;
clear all;
close all;
%filter specifications
wp=input('enter the pass band edge frequency:');
ws=input('enter the stop band edge frequency:');
rp=input('enter the pass band ripple:');
rs=input('enter the stop band gain:');
%to find order of filter
[n]=buttord(wp,ws,rp,rs,'s');
%to find cutoff frequency
wc=[wp ws];
%band pass filtering
[b,a]=butter(n,wc,'bandpass','s');
%plotting magnitude and phase response
figure(1);
freqs(b,a);

%butterworth band stop filter

clc;
clear all;
close all;
%filter specifications
wp=input('enter the pass band edge frequency:');
ws=input('enter the stop band edge frequency:');
rp=input('enter the pass band ripple:');
rs=input('enter the stop band gain:');
%to find order of filter
[n]=buttord(wp,ws,rp,rs,'s');
%to find cutoff frequency
wc=[wp ws];
%band stop filtering
[b,a]=butter(n,wc,'stop','s');
%plotting magnitude and phase response
figure(1);
freqs(b,a);

%butterworth low pass filter


clc;
clear all;
close all;
%butterworth low pass filter
%filter specifications
k1=input('enter the pass band gain in db:');
k2=input('enter the stop band gain in db:');
w1=input('enter the pass band edge frequency in radians:');
w2=input('enter the stop band edge frequency in radians:');
[n,wc]=buttord(w1,w2,k1,k2,'s');
disp('the order is:');
disp(wc);
%low pass filter
[b,a]=butter(n,wc,'low','s');
%plotting the magnitude and phase response
f=linspace(1,512,1000);
h=freqs(b,a,f);
m=20*log(abs(h));
subplot(2,1,1);
semilogx(f,m);
xlabel('frequency');
ylabel('magnitude');
title('magnitude of butterworth low pass filter');
%phase response
p=angle(h);
subplot(2,1,2);
semilogx(f,p);
xlabel('frequency');
ylabel('phase');
title('phase response of butterworth low pass filter');
%butterworth high pass filter
clc;
clear all;
close all;
%filter specifications
k1=input('enter the pass band gain in db:');
k2=input('enter the stop band gain in db:');
w1=input('enter the pass band edge frequency in radians:');
w2=input('enter the stop band edge frequency in radians:');
[n,wc]=buttord(w1,w2,k1,k2,'s');
disp('the order is:');
disp(wc);
%high pass filter
[b,a]=butter(n,wc,'high','s');
%plotting the magnitude and phase response
f=linspace(1,512,1000);
h=freqs(b,a,f);
m=20*log(abs(h));
subplot(2,1,1);
semilogx(f,m);
xlabel('frequency');
ylabel(‘magnitude’);
title('magnitude of butterworth high pass filter');
%phase response
p=angle(h);
subplot(2,1,2);
semilogx(f,p);
xlabel('frequency');
ylabel('phase');
title('phase response of butterworth high pass filter');
MODEL GRAPHS:
ii. CHEBYSHEV
%program for band pass filter
clc;
close all;
clear all;
format long
rp=input('enter the passband ripple:');
rs=input('enter the stopband ripple:');
wp=input('enter the passband frequency:');
ws=input('enter the stopband frequency:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n]=cheb1ord(w1,w2,rp,rs);
wn=[w1,w2];
[b,a]=cheby1(n,rp,wn,'bandpass');
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('gain in db...>');
xlabel('(a)normalised frequency...>');
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)normalised frequency...>');
ylabel('phase in radians...>');
%program for band stop filter

clc;
close all;
clear all;
format long
rp=input('enter the passband ripple:');
rs=input('enter the stopband ripple:');
wp=input('enter the passband frequency:');
ws=input('enter the stopband frequency:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n]=cheb1ord(w1,w2,rp,rs);
wn=[w1,w2];
[b,a]=cheby1(n,rp,wn,'stop');
w=0:0.1/pi:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('gain in db...>');
xlabel('(a)normalised frequency...>');
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)normalised frequency...>');
ylabel('phase in radians...>');

%low pass filter


Clc;
close all;
clear all;
format long
rp=input('enter the passband ripple:');
rs=input('enter the stopband ripple:');
wp=input('enter the passband frequency:');
ws=input('enter the stopband frequency:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs);
[b,a]=cheby1(n,rp,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('gain in db...>');
xlabel('(a)normalised frequency...>');
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)normalised frequency...>');
ylabel('phase in radian’);
% high pass filter
clc;
close all;
clear all;
format long
rp=input('enter the passband ripple:');
rs=input('enter the stopband ripple:');
wp=input('enter the passband frequency:');
ws=input('enter the stopband frequency:');
fs=input('enter the sampling frequency:');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=cheb1ord(w1,w2,rp,rs);
[b,a]=cheby1(n,rp,wn,'high');
w=0:0.01/pi:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('gain in db...>');
xlabel('(a)normalised frequency...>');
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b)normalised frequency...>');
ylabel('phase in radians...>');

MODEL GRAPH
PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.

5.6 ERROR:
No Errors.

5.7 RESULT:
The IIR Butterworth band pass filter, band stop filter, low pass filter and high pass filter
are simulated.

5.8ANALYSIS:
The input sequence is given and filters are designed by magnitude and phase response.
5.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.
5.10 CONCLUSION:
Hence, the Butterworth band pass, band stop, low pass and high pass filter are designed
and plotted by using MATLAB.
VIVA-VOCE QUESTIONS:

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


ii. Give the difference between analog and digital filter?
iii. What is the difference between type 1 and type 2 filter structure?
iv. what is the role of delay element in filter design?
v. Explain how the frequency is filter in filters?
vi. Differences between Butterworth chebyshev filters?
vii. Can IIR filters be Linear phase? how to make it linear Phase?
viii. What is the special about minimum phase filter?
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 6
6.1 TITLE: DESIGN OF FIR DIGITAL FILTER
6.2 OBJECTIVE:
i. To design FIR low pass filter, high pass filter, band pass filter, band stop filter using
Chebyshev Transfer Function.
6.3 SOFTWARE REQUIRED:

i. MATLAB software
ii. Personal Computer
6.4 THEORY:
In signal processing, a finite impulse response (FIR) filter is a filter whose impulse
response (or response to any finite length input) is of finite duration, because it settles to zero in
finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal
feedback and may continue to respond indefinitely (usually decaying).
The impulse response (that is, the output in response to a Kronecker delta input) of an
Nth-order discrete-time FIR filter lasts exactly N + 1 samples (from first nonzero element
through last nonzero element) before it then settles to zero.
FIR filters can be discrete-time or continuous-time, and digital or analog.

6.5 SOURCE CODE:


clc;
clear all;
close all;
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');
r=input('enter the ripple in db');
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);
if(rem(n,2)==0)
n=n+1;
end
y=chebwin(n,r);

%Low Pass Filter

b=fir1(n-1,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
ylabel('gain in DB');
xlabel('normalized frequency');
title('low pass filter');

%High Pass Filter

b=fir1(n-1,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
ylabel('gain in DB');
xlabel('normalized frequnecy');
title('high pass filter');

%Band Pass Filter

wn=[wp,ws];
b=fir1(n-1,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
ylabel('gain in Db');
xlabel('normalized frequency');
title('band pass filter');

%Band Stop Filter

wn=[wp,ws];
b=fir1(n-1,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
ylabel('gain in Db');
xlabel('normalized frequency');
title('band stop filter');

MODEL GRAPHS:

PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.

6.6 ERROR:
No Errors.

6.7 RESULT:
Hence the FIR low pass, high pass, band pass, band stop filters are designed using
chebyshev Transfer Function.
6.8ANALYSIS:
With the help Chebychev Transfer Function the FIR filters are designed.

6.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.

6.10 CONCLUSION:
Hence the FIR filters are designed using Chebychev Transfer Function.
VIVA-VOCE QUESTIONS:

i. What is filter?
ii. What is FIR and IIR filter define, and distinguish between these two?
iii. What are low-pass and band-pass filter and what is the difference between these two?
iv. What do you mean by built in function ‘abs’ and where it is used?
v. What are the advantages of FIR Filters (compared to IIR filters)?
vi. What are the disadvantages of FIR Filters (compared to IIR filters)?
vii. What terms are used in describing FIR filters?
viii. What is the delay of a linear-phase FIR?
ix. What is the Z transform of a FIR filter?
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 7
7.1 TITLE: DESIGN OF FIR DIGITAL FILTER
c) HAMMING WINDOW
d) RECTANGULAR WINDOW

7.2 OBJECTIVE:
i. To design FIR low pass and high pass filters using Hamming Window, Hanning
Window and Rectangular Windows.
7.3 SOFTWARE REQUIRED:

i. MATLAB software
ii. Personal Computer
7.4 THEORY:

Window Type Weight Equation

Rectangular

Bartlett

Hanning

Hamming
Blackman

7.5 SOURCE CODE:


% FIR Filter design using rectangular window
%Low Pass Filter
clc;
clear all;
close all;
N=input ('size of window');
wc=input('cut off frequency');
h=fir1(N-1,wc/pi,boxcar(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('frequency');
ylabel('magnitude');
title('FIR low pass filter');

%High Pass Filter


clc;
clear all;
close all;
N=input ('size of window');
wc=input('cut off frequency');
h=fir1(N-1,wc/pi,’high’,boxcar(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('frequency');
ylabel('magnitude');
title('FIR high pass filter');

% FIR Filter design using Hamming window


%Low Pass Filter
clc;
clear all;
close all;
N=input('size of window');
wc1=input(' lower cut off frequency');
h=fir1(N-1,wc1/pi,hamming(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('frequncy');
ylabel('magnitude');
title('FIR low pass filter');

%High Pass Filter


clc;
clear all;
close all;
N=input('size of window');
wc1=input(' lower cut off frequency');
h=fir1(N-1,wc1/pi,hanning(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('frequncy');
ylabel('magnitude');
title('FIR high filter');

% FIR Filter design using Hanning window


%Low Pass Filter
clc;
clear all;
close all;
N=input('size of window');
wc1=input(' lower cut off frequency');
h=fir1(N-1,wc1/pi,hanning(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('frequncy');
ylabel('magnitude');
title('FIR low pass filter');
%High Pass Filter
clc;
clear all;
close all;
N=input('size of window');
wc1=input(' lower cut off frequency');
h=fir1(N-1,wc1/pi,hanning(N));
tf(h,1,1,'variable','z^-1');
freqz(h);
xlabel('frequncy');
ylabel('magnitude');
title('FIR high filter');
MODEL GRAPHS:
PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.

7.6 ERROR:
No Errors.

7.7 RESULT:
Hence the FIR filters are obtained using Windowing Techniques.

7.8ANALYSIS:
With the help of Windowing Techniques FIR low pass ,high pass, band pass and band
stop filters are designed.
7.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.
7.10 CONCLUSION:
Hence the FIR filters are obtained using different Windowing Techniques by MATLAB
programs.
VIVA-VOCE QUESTIONS:
i. What is the matlab command for Hamming window? Explain.
ii. What is window method? How you will design an FIR filter using window method
iii. Explain how the FIR filter are stable?
iv. Why is the impulse response "finite"?
v. What does "FIR" mean?
vi. What is the frequency response formula for a FIR filter?
vii. How Can I calculate the frequency response of a FIR using the Discrete Fourier
Transform (DFT)?
viii. What is the DC gain of a FIR filter?
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 8
8.1 TITLE: DESIGN OF SAMPLING TECHNIQUES
8.2 OBJECTIVE:
i. To obtain sampling, resampling, upsampling and down sampling for an input signal.

8.3 SOFTWARE REQUIRED:

i. MATLAB software
ii. Personal Computer
8.4 THEORY:
In Signal processing, sampling is the reduction of a continuous time signal to a discrete time
signal. A common example it is conversion of sound wave into a sequence of samples.
i. The process of converting a sampled digital signal to that of a higher sampling rate using
various digital filtering techniques.
ii. Resampling is usually done to interface two systems which have different sampling rates.
iii. Increasing the sampling rate of a signal is called up sampling .
iv. In Signal processing, decimation is process of reducing the sampling rate of signal ,one
step of this process is called down sampling.
8.5 SOURCE CODE:
clc;
clear all;
close all;
a=input('enter the amplitude:');
f=input('enter the time period');
t=-10:0.5:20;
x=a*sin(2*pi*f*t);
subplot(2,3,1);
stem(t,x);
xlabel('time');
ylabel('amplitude');
title('sinusoidal signal');

d=input('enter the value by which signal is to be decimated:');


y1=decimate(x,d);
subplot(2,3,2);
stem(y1);
xlabel('time');
ylabel('amplitude');
title('decimated signal');

i= input('enter the value by which signal is to be interpolated:');


y2=interp(x,i);
subplot(2,3,3);
stem(y2);
xlabel('time');
ylabel('amplitude');
title('interpolated signal');

y3=resample(x,3,2);
subplot(2,3,4);
stem(y3);
xlabel('time');
ylabel('amplitude');
title('resampled signal');

y4=downsample(x,2);
subplot(2,3,5);
stem(y4);
xlabel('time');
ylabel('amplitude');
title('downsampled signal');

y5=upsample(x,3);
subplot(2,3,6);
stem(y5);
xlabel('time');
ylabel('amplitude');
title('upsampled signal');
MODEL GRAPH:

PROCEDURE:
i. Click on the MATLAB Icon on the desktop.
ii. MATLAB window open.
iii. Click on the ‘FILE’ Menu on menu bar.
iv. Click on NEW M-File from the file Menu.
v. An editor window open, start typing commands.
vi. Now SAVE the file in directory.
vii. Then Click on DEBUG from Menu bar and Click Run.

8.6 ERROR:
No Errors.

8.7 RESULT:
The Different sampling techniques such as decimation ,interpolation ,upsampling and
down sampling are performed and the increase and decrease in the sampling rate is observed.

8.8ANALYSIS:
In Upsampling the sampling rate of the input sequence is increased and in downsampling
the sampling rate of the input sequence is decreased ,In interpolation is process of upsampling
followed by filtering. (The filtering removes the undesired samples.)
8.9 PRECAUTIONS:
i. Syntax errors are to be avoided.
ii. Dimensions of the variable are to be given correctly.
8.10 CONCLUSION:
Hence the decimated, interpolated, up sampled and down sampled signals of an input
sequence are plotted using Matlab.
VIVA-VOCE QUESTIONS:

i. What is the importance of decimation for a given signal/sequence?


ii. What do you mean Aliasing? What is the condition to avoid aliasing for sampling?
iii. How does poly phase filtering save computations in a decimation filter?
iv. Give any practical application of decimation?
v. Which signals can be down sampled?
vi. What happens if I violate the Nyquist criteria in down sampling or decimating?
vii. Can we do decimate in multiple stages?
viii. What are "decimation" and "downsampling"?
ix. What is the "decimation factor"?
x. What are "upsampling" and "interpolation"?
xi. Why interpolate,i needed for any signal/sequence?
xii. What is the "interpolation factor"?
xiii. Which signals can be interpolated?
xiv. Can interpolate will happens in multiple stages? If yes give reason?
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 9
9.1 TITLE: VERIFICATION OF LINEAR CONVOLUTION USING DSP PROCESSOR KIT
9.2 OBJECTIVE:
i. To verify Linear Convolution using Code Composer Studio.
9.3 SOFTWARE REQUIRED:

i. Operating System – Windows XP


ii. Constructor - Simulator
iii. Software – Code Composer 3.1v,6713DSK Diagnostics

HARDARE REQUIREMENTS:

i. TMS320C6713DSP KIT
ii. USB cable
iii. Power Supply +5v

9.4 THEORY:
1. linear convolution :it is the basic operation to calculate the output for any linear time
invariant system given its input and its impulse response. e.g: x1={1,2,3,4} ;
x2={2,3,4,5}

2 3 4 5
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20

Ans: F={2,7,16,30,34,31,20}
9.5 SOURCE CODE:
/* prg to implement linear convolution */
#include<stdio.h>
#include<math.h>
int y[20];
main()
{ int m=6; /*Lenght of i/p samples sequence*/
int n=6; /*Lenght of impulse response Co-efficients */
int i=0,j;
int x[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Input Signal Samples*/
int h[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Impulse Response Coefficients*/
for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
printf("Linear Convolution\n");
for(i=0;i<m+n-1;i++)
printf("%d\n",y[i]);
}
Verification using matlab
x = [1,2,3,4];
y = [1,2,3,4];
output = conv(x,y)
output =
1 4 10 20 25 24 16
Model Graph:

PROCEDURE:

i. Open code composer studio


ii. Create a new project, give a meaningful name ,save into working folder, select target
asMS320C6713, and select output file type is execution. out.
iii. Click on file open new source file save it with .c extension in working folder and write
.c- code for desired task.
iv. Add c-file to project as a source [path source add files to project add c. file].
v. Add the linker command file hello .cmd.[path c.\ccstudio-
v3.1\tutorial\dsk67/3\HELLO1\Hello.cmd]
vi. Add the run time support library file rts6700.lib.[path c.\ccstudio-v.3.1\c600\cg
tools\lib\rts6700.lib].
vii. Compile the program [path project compile file]
viii. Build the program [path project build]
ix. Connect the kit to the system through the USB cable
x. Then switch on the kit
xi. And now check the DSK6713 diagnostics kit whether all the connections are Made
correctly or not
xii. Then select [debug connect] on the cc studio window
xiii. Load the program [file load program]
xiv. Run the program [debug run].
9.6 ERROR:
No Errors.
9.7 RESULT:
Hence the Linear Convolution performed for given two input sequences, using Code
Composer Studio
9.8ANALYSIS:

9.9 PRECAUTIONS:

i. Switch ON the computer only after connecting USB cable and make sure the DSP kit is
ON.
ii. Perform the diagnostic check before opening code composer studio.
iii. All the connections must be tight.

9.10 CONCLUSION:
Hence for two input sequences the corresponding linear convolution is plotted using code
composer studio.
VIVA-VOCE QUESTIONS:
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 10
10.1 TITLE: VERIFICATION OF CIRCULAR CONVOLUTION USING DSP PROCESSOR
KIT
10.2 OBJECTIVE:
i. To verify Circular Convolution using Code Composer Studio.
10.3 SOFTWARE REQUIRED:

i. Operating System – Windows XP


ii. Constructor - Simulator
iii. Software – Code Composer 3.1v,6713DSK Diagnostics

HARDARE REQUIREMENTS:

i. TMS320C6713DSP KIT
ii. USB cable
iii. Power Supply +5v

10.4 THEORY:
1. circular convolution method: it is the basic operation of a two periodic function occurs
when one of them is convolued in the normal way with a periodic summation of the other
function.
e.g: x1={1,2,3,4} ; x2={2,3,4,5}

Ans: f={36,38,36,30}
2. linear convolution using circular convolution:
i. Linear convolution is the basic operation to calculate the output for
any linear time invariant system given its input and its impulse response.
ii. Circular convolution is the same thing but considering that the support of the
signal is periodic.(it is done using matrix multiplication method)
iii. It has a length of n=L+m-1 sequences.

e.g: x1={1,2,3,4} ; x2={2,3,4,5}


Where L=4 for input sequence 1. M=4 for input sequence 2 .
N=L+m-1=4+4-1=7 (zero padding).
The resultant input sequences are:
X1={1,2,3,4,0,0,0) ; X2={2,3,4,5,0,0,0}

y(n)={2,7,16,30,34,31,20}

10.5 SOURCE CODE:


#include<stdio.h>
#include<math.h>
int m,n,x[30],h[30],y[30],i,j,temp[30],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]);
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 sequence 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];
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]);
}
Verification of circular convolution using matlab
x1=[1 2 3 4];
x2=[4 3 2 1];
n = 4;
X1=fft(x1,n);
X2=fft(x2,n);
Y=X1.*X2;
y=ifft(Y,n);
disp(y)
y = 24 22 24 30
Model Graph:

PROCEDURE:

i. Open code composer studio


ii. Create a new project, give a meaningful name ,save into working folder, select target
asMS320C6713, and select output file type is execution. out.
iii. Click on file open new source file save it with .c extension in working folder and write
.c- code for desired task.
iv. Add c-file to project as a source [path source add files to project add c. file].
v. Add the linker command file hello .cmd.[path c.\ccstudio-
v3.1\tutorial\dsk67/3\HELLO1\Hello.cmd]
vi. Add the run time support library file rts6700.lib.[path c.\ccstudio-v.3.1\c600\cg
tools\lib\rts6700.lib].
vii. Compile the program [path project compile file]
viii. Build the program [path project build]
ix. Connect the kit to the system through the USB cable
x. Then switch on the kit
xi. And now check the DSK6713 diagnostics kit whether all the connections are Made
correctly or not
xii. Then select [debug connect] on the cc studio window
xiii. Load the program [file load program]
xiv. Run the program [debug run].

10.6 ERROR:
No Errors.
10.7 RESULT:
Hence the Circular Convolution performed for given two input sequences, using Code
Composer Studio

10.8ANALYSIS:

10.9 PRECAUTIONS:

i. Switch ON the computer only after connecting USB cable and make sure the DSP kit is
ON.
ii. Perform the diagnostic check before opening code composer studio.
iii. All the connections must be tight.

10.10 CONCLUSION:
Hence for two input sequences the corresponding circular convolution is plotted using
code composer studio.
VIVA-VOCE QUESTIONS:
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES
SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 11
11.1 TITLE: IMPLEMENTATION OF IIR FILTERS ON DSP PROCESSOR
11.2 OBJECTIVE:
i. To verify IIR filters using Code Composer Studio.
11.3 SOFTWARE REQUIRED:

i. Operating System – Windows XP


ii. Constructor - Simulator
iii. Software – Code Composer 3.1v,6713DSK Diagnostics

HARDARE REQUIREMENTS:

i. TMS320C6713DSP KIT
ii. USB cable
iii. Power Supply +5v

11.4 THEORY:
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. The simplest analog IIR filter is
an RC filter made up of a single resistor (R) feeding into a node shared with a single
capacitor (C). This filter has an exponential impulse response characterized by an RC
time constant. Because the exponential function is asymptotic to a limit, and thus never
settles at a fixed value, the response is considered infinite.
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.
Note that unlike FIR filters, in designing IIR filters it is necessary to carefully consider
the "time zero" case in which the outputs of the filter have not yet been clearly defined.
Example IIR filters include the Chebyshev filter, Butterworth filter, and the Bessel filter.

Digital filters are often described and implemented in terms of the difference
equation that defines how the output signal is related to the input signal:
where:

P is the feedforward filter order


bi are the feedforward filter coefficients
Q is the feedback filter order
ai are the feedback filter coefficients
x[n] is the input signal
y [n] is the output signal.

After derived the above equation , finally Considering that in most IIR filter designs
coefficient is 1, the IIR filter transfer function takes the more traditional form:

11.5 SOURCE CODE:

High pass IIR Filter:


#include "stdio.h"
#include
int i,w,wc,c,N;
float H[100];
float mul(float, int);
void main()
{
printf("\n Enter order of IIR HP Filter: ");
scanf("%d",&N);
printf("\n Enter the Cutoff Freq: ");
scanf("%d",&wc); 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]);
}
}
float mul(float a,int x)
{
for(i=0;i<x-1;i++) a*=a;
return(a);
}
// LOW PASS IIR FILTER
#include "stdio.h"
#include
int i,w,wc,c,N; float H[100];
float mul(float, int);
void main()
{
printf("\n Enter order of IIR LP Filter:");
scanf("%d",&N);
printf("\n Enter the Cutoff Freq ");
scanf("%d",&wc);
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]);
}
}
float mul(float a,int x)
{
for(i=0;i<x-1;i++) a*=a; return(a);
}

PROCEDURE:

i. Open code composer studio


ii. Create a new project, give a meaningful name ,save into working folder, select target
asMS320C6713, and select output file type is execution. out.
iii. Click on file open new source file save it with .c extension in working folder and write
.c- code for desired task.
iv. Add c-file to project as a source [path source add files to project add c. file].
v. Add the linker command file hello .cmd.[path c.\ccstudio-
v3.1\tutorial\dsk67/3\HELLO1\Hello.cmd]
vi. Add the run time support library file rts6700.lib.[path c.\ccstudio-v.3.1\c600\cg
tools\lib\rts6700.lib].
vii. Compile the program [path project compile file]
viii. Build the program [path project build]
ix. Connect the kit to the system through the USB cable
x. Then switch on the kit
xi. And now check the DSK6713 diagnostics kit whether all the connections are Made
correctly or not
xii. Then select [debug connect] on the cc studio window
xiii. Load the program [file load program]
xiv. Run the program [debug run].

11.6 ERROR:
No Errors.
11.7 RESULT:
Hence verified the IIR filters using Code Composer Studio.
11.8ANALYSIS:

11.9 PRECAUTIONS:

i. Switch ON the computer only after connecting USB cable and make sure the DSP kit is
ON.
ii. Perform the diagnostic check before opening code composer studio.
iii. All the connections must be tight.

11.10 CONCLUSION:
VIVA-VOCE QUESTIONS:

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


ii. Give the difference between analog and digital filter?
iii. What is the difference between type 1 and type 2 filter structure?
iv. What is the role of delay element in filter design?
v. Explain how the frequency is filter in filters?
vi. Differences between Butterworth chebyshev filters?
vii. Can IIR filters be Linear phase? how to make it linear Phase?
viii. What is the special about minimum phase filter?

GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G COURSES


SCHOOL OF ENGINEERING
Rushikonda, Visakhapatnam- 530 045.
(Approved by A.I.C.T.E, Permanently Affiliated to Andhra University)

Expt. No: 12
12.1 TITLE: IMPLEMENTATION OF FIR FILTERS USING WINDOW TECHNIQUES ON
DSP PROCESSOR.

12.2 OBJECTIVE:
i. To verify FIR filters using Code Composer Studio.

12.3 SOFTWARE REQUIRED:

i. Operating System – Windows XP


ii. Constructor - Simulator
iii. Software – Code Composer 3.1v,6713DSK Diagnostics

HARDARE REQUIREMENTS:

i. TMS320C6713DSP KIT
ii. USB cable
iii. Power Supply +5v

12.4 THEORY:
DESIGNING AN FIR FILTER:
Following are the steps to design linear phase FIR filters Using Windowing Method.
i. Clearly specify the filter specifications.
Eg: Order = 30;
Sampling Rate = 8000 samples/sec
Cut off Freq. = 400 Hz.
ii. Compute the cut-off frequency Wc
Eg: Wc = 2*pie* fc / Fs
= 2*pie* 400/8000
= 0.1*pie
iii. Compute the desired Impulse Response h d (n) using particular Window.
Eg: b_rect1=fir1(order, Wc , 'high',boxcar(31));
iv. Convolve input sequence with truncated Impulse Response x (n)*h (n).

12.5 SOURCE CODE:

PROCEDURE:
i. Open code composer studio
ii. Create a new project, give a meaningful name ,save into working folder, select target
asMS320C6713, and select output file type is execution. out.
iii. Click on file open new source file save it with .c extension in working folder and write
.c- code for desired task.
iv. Add c-file to project as a source [path source add files to project add c. file].
v. Add the linker command file hello .cmd.[path c.\ccstudio-
v3.1\tutorial\dsk67/3\HELLO1\Hello.cmd]
vi. Add the run time support library file rts6700.lib.[path c.\ccstudio-v.3.1\c600\cg
tools\lib\rts6700.lib].
vii. Compile the program [path project compile file]
viii. Build the program [path project build]
ix. Connect the kit to the system through the USB cable
x. Then switch on the kit
xi. And now check the DSK6713 diagnostics kit whether all the connections are Made
correctly or not
xii. Then select [debug connect] on the cc studio window
xiii. Load the program [file load program]
xiv. Run the program [debug run].

12.6 ERROR:
No Errors.
12.7 RESULT:
12.8ANALYSIS:
12.9 PRECAUTIONS:

i. Switch ON the computer only after connecting USB cable and make sure the DSP kit is
ON.
ii. Perform the diagnostic check before opening code composer studio.
iii. All the connections must be tight.

12.10 CONCLUSION:

VIVA-VOCE QUESTIONS:

You might also like