Dsp Lab Modified Manual
Dsp Lab Modified Manual
SCHOOL OF ENGINEERING
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND PG COURSES
Approved by AICTE, Permanently Affiliated to Andhra University
Rushikonda, Visakhapatnam-530 045
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:
ii. To Calculate and Plot DFT / IDFT of given DT signal and prove it theoretical.
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.
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
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
LIST OF EXPERIMENTS
Cycle: 1
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
i. MATLAB software
1.4 THEORY:
1 for t = 0
i. UNIT IMPULSE SIGNAL/SEQUENCE: (t ) =
0 otherwise
v. SINUSOIDAL SIGNAL:
vi. RANDOM SIGNAL:
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.
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)');
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).
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:
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)
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);
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);
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...>');
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:
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.
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');
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');
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');
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:
Rectangular
Bartlett
Hanning
Hamming
Blackman
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.
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');
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:
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:
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:
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:
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.
y(n)={2,7,16,30,34,31,20}
PROCEDURE:
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:
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:
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:
PROCEDURE:
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:
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.
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).
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: