Professional Documents
Culture Documents
DSP LAB Student Manual
DSP LAB Student Manual
LAB
(20EC6103)
III-B. TECH II-SEMSTER
(AR20)
CERTIFICATE
Vision
“Raghu Institute of Technology has a clear vision of becoming a leading institution of higher learning
in technical education in the world by building on the best of instructional infrastructure, enlisting the
service of expert faculty and strengthening strategic linkage with the industry and other educational
institutions”.
Mission
“Raghu Institute of Technology strives to train the students in technical education with moral values and
discipline among the students, so that their future is blossomed with good culture. The Institute aims to
chisel the students to be endowed with a perfect synthesis of human values, ancient wisdom and modern
thoughts that will enable to build their career”.
Vision
“Lead in the creation and development of intellectual and human capital in Electronics and
Communication Engineering and their applications in order to foster the technological, economic and
social enrichment of the State of Andhra Pradesh, the nation and the world”.
Mission
By imparting quality technical education to provide excellence in education for the students to
M1
compete internationally.
To make the students responsible towards the ethical, environmental and economic growth of
M2
the society.
i
To improve the level of perception of students which helps to disseminate knowledge essential
M3
to meet local & global needs in the field of Electronics and Communication Engineering.
M4 To develop consciousness in the young minds that can understand universal moral values.
1. Domain Knowledge: To have thorough knowledge and technical skills required to remain
productive.
2. Communication Skills & Employability: To apply technical knowledge and skills as Electronics
and Communication Engineer to provide effective solutions in industrial and governmental
organizations.
3. Lifelong Learning & Social Concern: To achieve success with awareness of entrepreneurship
skills along with ability for lifelong learning in pursuit of professional and social development that
meet the emerging and evolving demands for a successful career.
ii
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive clear
instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
iii
III Year-II semester L T P C
0 0 3 1.5
List of Experiments:
1. To find the linear and circular convolution for the given two sequences.
2. To find Auto correlation and Cross Correlation for the given two sequences.
3. Implementation of linear convolution using DFT (Overlap-add and Save method)
4. Computation of N-Point DFT of a sequence and to plot magnitude and phase spectrum.
5. Implementation of Decimation-in-time radix-2 FFT algorithm
6. Implementation of Decimation-in-frequency radix-2 FFT algorithm
7. Design of IIR filters (LPF/HPF) and demonstrates the filtering operation.
8. Design of FIR filters (LPF/HPF) and demonstrates the filtering operation.
9. Implementation of Decimation and Interpolation Process
10. Implementation of I/D sampling rate converters
11. To perform MAC operation using various addressing modes in DSP processors
12. Implementation of Up sampling and Down sampling operations in DSP processors
3. DSP processor
iv
INSTRUCTIONS TO THE STUDENTS
Do’s
2. When you leave, make sure your computer is properly shut down
4. Observation book of the present lab experiment should be get corrected on the same day
and Record should be corrected on the next scheduled lab session
6. Report any problem with your computer to the teacher / laboratory technician
immediately.
Don’ts
v
CONTENTS
2 To find Auto correlation and Cross Correlation for the given two sequences. 16-21
4 Computation of N-Point DFT of a sequence and to plot magnitude and phase 28-31
spectrum.
5 Implementation of Decimation-in-time radix-2 FFT algorithm 32-35
v
Department of Electronics & Communication Engineering Digital Signal Processing Lab
INTRODUCTION TO MATLAB
MATLAB is a software package for high-performance language for technical computing. It integrates
computation, visualization, and programming in an easy-to-use environment where problems and
solutions are expressed in familiar mathematical notation. Typical uses include the following.
The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy
access to matrix software developed by the LINPACK and EISPACK projects. Today, MATLAB
engines incorporate the LAPACK and BLAS libraries, embedding the state of the art in software for
matrix computation.
MATLAB has evolved over a period of years with input from many users. In university environments,
it is the standard instructional tool for introductory and advanced courses in mathematics, engineering,
and science. In industry, MATLAB is the tool of choice for high-productivity research, development,
and analysis.
1. Advance algorithm for high performance numerical computation, especially in the Field matrix
algebra
2. A large collection of predefined mathematical functions and the ability to defineone’s own
functions.
3. Two-and three-dimensional graphics for plotting and displaying data.
4. A complete online help system
5. Powerful, matrix or vector oriented high level programming language for individual applications.
6. Toolboxes available for solving advanced problems in several application areas.
In the following sections, individual elements of MATLAB operations are explained in detail.
EXPRESSIONS:
Like most other programming languages, mat lab provides mathematical expressions, but unlike most
programming languages these expressions involve entire matrices. The building blocks of expressions
are
Variables
Numbers
Operators
Functions
HANDLING MATRICES:
MATLAB was mainly designed to deal with matrices in MATLAB a matrix is a rectangular array of
numbers so scalars can be interpreted to be 1x1 matrices and vectors are matrices with only one row or
column. MATLAB has other ways to store both numeric and non-numeric data, but in the beginning
of learning MATLAB, it is usually best to think of everything as a matrix. The operations in MATLAB
are designed to be as natural as possible. Where other programming languages work only with single
numbers, MATLAB allows with entire matrices quickly and easily.
ENTERING MATRICES AND ADDRESSING THE ELEMENTS:
The elements of matrix must be entered one-by-one in a list where the elements of row must be
separated with commas or blank spaces and rows are divided by semicolons.
CONCATENATION:
Concatenation is the process of joining small matrices to make bigger ones. In fact, the first matrix A
was created by concatenating its individual elements. The pair of square brackets, [ ], is the
Concatenation operator. For an example, start with the 3x3 matrix A, form
>>F= [A A+10;A*2 A*4].
The result is a 6x6 matrix, obtained by joining the four submatrices.
F= 1 2 3 11 12 13
8 6 4 18 16 14
3 6 9 13 16 19
2 4 6 4 8 12
16 2 8 32 24 16
6 12 19 12 24 38
FILE TYPES:
MATLAB has three types of files for storing information:
M-files are standard ASCII text files, with .m extension to the file name. There are two types of these
files: script file and function files. Most of the programs we write in mat lab are saved as M-files. All
built in functions in matlab are M-files, most of which reside on our computer in precompiled format.
Some built-in functions are provided with source code in readable M-files so that they can be copied
and modified.
Mat-files are binary data files, with .mat extension to the file name. Mat-files are created by mat lab
when we save data with the save command. The data is written in a special format that only mat lab
can read. Mat-files can be loaded in to mat lab with the load command.
M-FILES:
In MATLAB we write our programs in M-file. M-files are ordinary ASCII text files written in mat
lab’s language. They are called M-files because they must have ‘.m’ at the end of their name. M-files
can be created using any editor or word processing applications. There are two types of M-files –script
files and function files.
A script file is an M-file with a set of valid mat lab commands in it. A script file is executed by typing
the name of the file and the command line. It is equivalent to typing all the commands stored in the
script file, one by one, at the mat lab prompt. Naturally, script files work on global variables, i.e
variables currently present in the workspace. Results obtained from executing script files are left in the
workspace. A script file may contain any number of commands including those that call built-in
functions or function written by us. Script files are useful when we have to repeat the set of commands
several times.
A function file is also an M-file like a script file, except that the variables in the function file are all
local. Function files are like programs or subroutines in Fortran, procedures in Pascal, and functions in
C. A function file begins with a function definition line, which has a well defined list of inputs and
outputs. Without this line, the file becomes a script file.
MATLAB WINDOWS:
GRAPHICAL WINDOW:
The output of all graphics commands typed in the command window are flushed to the graphics or
Figure window, a separate gray window with white background colour. The user can create as many
figure windows as the system memory will allow.
EDIT WINDOW:
This is where we write, edit, create, and save our own programs in files called ‘M-files’. We can use
any text editor to carry out these tasks. On most systems, MATLAB provides its own built-in editor.
However, we can use our own editor by typing the standard file-editing command that we normally use
on our system.
FLOW CONTROL:
Computer programming languages offer possibilities to allow the programmer to control the flow of
command execution. This flow control is based on decision making structures. Some of the most
important structures are the for-loop, the while loop and the if-else-end-structure. Since the
constructions often affect several MATLAB commands, they are mostly used in m-files. The for-loop
repeats a group of statement a fixed, predetermined number of times. The general form of for-loop is
>>for x = array
Commands…..
End
The commands…between for and the end statements are executed one time for every column in
array. For
Example
>> for k = 1:10
z(k)=2*I;
End
>>z
z = [2 4 6 8 10 12 14 16 18 20]
it is good idea to indent the loops for readability, especially when they are nested.
>>for 1=1.5
for m=1:8
H(1,m) =1/1+m;
end
end
Raghu Institute of Technology (Autonomous), Dakamarri , Visakhapatnam 7
Department of Electronics & Communication Engineering Digital Signal Processing Lab
1. Open MATLAB
2. In Menu bar, under ‘Home’ Tab, click on ‘Lay Out’ then ‘Default Layout’.
3. Under Tool Bar, click on ‘New Script’. (Ctrl+N)
4. Enter the MATLAB code. (In the Editor Window)
5. Click on ‘Save’ button. (Ctrl+S)
6. Enter the file (m-file) name without spaces and choose a proper destination folder.
7. Click on ‘Run’ button(F5)
8. Enter the inputs, if any. (in the command window)
EXPERIMENT NO:1
LINEAR AND CIRCULAR CONVOLUTION
AIM:
To write a MATLAB code to find linear and circular convolution.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
Convolution is a special operation, operated between two signals and whichincludes the following
operations.
Folding.
Shifting.
Multiplication.
Addition
Convolution sum is useful to obtain the response of discrete LTI system with input x(n)and
impulse response h(n).
Where N = N1+N2 –1 is the duration of convoluted sequence y(n). DFT does not support linear
convolution, because of x(n) and h(n) are of different durations. That’s why we can go for circular
convolution.
Circular convolution y(n) between two sequences x(n) and h(n) are of finite duration and both of
length N is given as,
Thus, if h(n) and x(n) are finite-length sequences of length N1 and N2, respectively, y(n)=h(n)*x(n)
is of length N1+N2-1, and the C-point circular convolution is equivalent to linear convolution
provided N ≥ N1+ N2 –1.
n2= length(x2);
N=n1+n2-1; %length of convolved sequence
X=[x1,zeros(1,N-n1)]; %zero padding to make sequences of length N
H=[x2,zeros(1,N-n2)]; %zero padding to make sequences of length N
y=zeros(1,N);
%performing linear convolution
for n=1:N
for k=1:n
y(n)=y(n)+X(k)*H(n-k+1);
end
end
disp('convolution of two sequences x1 and x2=');
disp(y);
subplot(2,2,1)
stem(x1);
xlabel('n --->')
ylabel('x1(n) --->')
title('INPUT SEQUENCE x1(n)')
subplot(2,2,2)
stem(x2);
xlabel('n --->')
ylabel('x2(n) --->')
title('INPUT SEQUENCE x2(n)')
subplot(2,2,3)
stem(y);
xlabel('n --->')
ylabel('x2(n) --->')
title('OUTPUT SEQUENCE y(n)')
INPUT:
Enter the first sequence, x1(n)=
Enter the second sequence, x2(n) =
OUTPUT:
Convolution of two sequences x1 and x2 =
N=max(n1,n2);%length of sequence
x1=[x1 zeros(1,N-n1)]; %modified first sequence
x2=[x2 zeros(1,N-n2)]; %modified second sequence
for n=0:N-1
y(n+1)=0;
for i=0:N-1
j=mod(n-i,N);
y(n+1)=y(n+1)+x1(i+1)*x2(j+1); %shifting and adding
end
end
%to display and plot circular convolution
n=1:N;
disp('output sequence of circular convolution, y(n)= ');
disp(y); %to view output in command window
%plotting circular convolution
subplot(3,1,1);
stem(x1);
xlabel('n1---->');
ylabel('amplitude');
title('first sequence');
subplot(3,1,2);
stem(x2);
xlabel('n2---->');
ylabel('amplitude');
title('second sequence');
subplot(3,1,3);
stem(n,y);
xlabel('n--->');
ylabel('amplitude');
INPUT:
Enter the first sequence, x1(n) =
Enter the second sequence, x2(n) =
OUTPUT:
Output sequence of circular convolution, y (n) =
RESULT:
VIVA QUESTIONS:
1. Which is also known as regular convolution?
2. What is the length of convolved sequence?
3. What is the difference between convolution and correlation?
4. Give the expression for discrete convolution?
5. Discuss the need for linear and circular convolution.
6. What is zero padding?
7. How do you perform circular convolution?
8. For periodic signals what convolution is to be used?
9. Which is better linear or circular convolution?
10. What is the command you have to perform circular convolution in Matlab?Give its syntax
EXPERIMENT NO:2
AUTO CORRELATION AND CROSS CORRELATION
AIM:
To write a MATLAB code to find the Auto correlation and Cross Correlation
for the given two sequences
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
The correlation of two functions or signals or waveforms is defined as the measure of similarity
between those signals. There are two types of correlations −
Cross-correlation
Autocorrelation
AUTOCORRELATION:
The autocorrelation function is defined as the measure of similarity or coherence between a signal and its
time delayed version. Therefore, the autocorrelation is the correlation of a signal with itself.
Autocorrelation sequence of x[n] is given by:
2. At zero lag, i.e., at l=0, the sample value of the autocorrelation sequence has its maximum value (equal
to the total energy of the signal) i.e.,
CROSS-CORRELATION:
The cross-correlation between two different signals is defined as the measure of similarity or coherence
between one signal and the time-delayed version of another signal.
A measure of similarity between a pair of energy signals x[n] and y[n] is given by the cross- correlation
sequence rxy[l] defined by:
The parameter ‘l’ called ‘lag’ indicates the time shift between the pair.
Comparing the equations for the linear convolution and cross correlation we find that,
convolving the reference signal with a folded version of sequence to be shifted (y[n]) results in cross
correlation output.
1)The cross-correlation sequence sample values are upper bounded by the inequality
2) The cross correlation of two sequences x[n] and y[n]=x[n-k] shows a peak at the value of k. Hence
cross correlation is employed to compute the exact value of the delay k between the 2 signals. Used in
radar and sonar applications, where the received signal reflected from the target is the delayed version of
the transmitted signal (measure delay to determine the distance of the target).
3) The ordering of the subscripts xy specifies that x[n] is the reference sequence That remains fixed in
time, whereas the sequence y[n] is shifted w.r.t x[n]. If y[n] is the reference sequence, then ryx [ l ]=rxy
clc;
close all;
clear all;
% input sequences
x=input('enter input sequence:');
subplot(1,2,1);
stem(x);
xlabel('n');
ylabel('x(n)');
title('input sequence');
% auto correlation of input sequence
z=xcorr(x,x);
disp('The o/p auto correlated sequence z= ');
disp(z);
subplot(1,2,2);
stem(z);
xlabel('n');
ylabel('z(n)');
title('auto correlation of input sequence')
INPUT:
Enter input sequence:
OUTPUT:
The values of z are =
xlabel('n');
ylabel('x(n)');
title('plot of x(n)');
n2 = length(y)-1; % graphical plot of second input sequence
t2 = 0:n2;
subplot(2,2,2);
stem(t2,y);
xlabel('n')
ylabel('y(n)');
title('plot of y(n)');
N = max(n1,n2); % graphical plot of output sequence
k = -N:N;
subplot(2,1,2);
stem(k,r);
xlabel('n');
ylabel('r(n)');
title('cross correlation output');
INPUT:
Enter the first sequence x(n) =
Enter the second sequence y(n) =
OUTPUT:
Cross Correlation Output =
RESULT :
VIVA QUESTIONS:
1. Write mathematical formula to find auto correlation?
2. Define auto correlation?
3. Define correlation.
4. Difference between Auto correlation and convolution?
5. Difference between Auto correlation and cross correlation?
6. Write mathematical formula to find cross correlation?
7. What is the length of the resultant sequence of auto correlation?
8. List few applications of correlation.
9. Give the properties of auto correlation.
10. Define cross correlation.
EXPERIMENT NO:3
LINEAR CONVOLUTION USING DFT
(OVERLAP-ADD AND SAVE METHOD)
AIM:
To write a MATLAB code to find the Linear convolution using DFT in Overlap-add and
Overlap-save method.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
Generally in discrete-time processing we talk about linearly convolving a sequence with a FIR filter. In
contrast, the FFT performs circular convolution with a filter of equal or lesser length. In computing the
DFT or FFT we often have to make linear convolution behave like circular convolution or vice versa.
Two methods that make linear convolution look like circular convolution are overlap-add and overlap-
save.
OVERLAP-ADD METHOD
This procedure cuts the signal up into equal length segments with no overlap. Then it zero-pads the
segments and takes the DFT of the segments. Part of the convolution result corresponds to the circular
convolution. The tails that do not correspond to the circular convolution are added to the adjoining tail of
the previous and subsequent sequence. This addition results in the aliasing that occurs in circular
convolution.
OVERLAP-SAVE METHOD
This procedure cuts the signal up into equal length segments with some overlap. Then it takes the DFT of
the segments and saves the parts of the convolution that correspond to the circular convolution. Because
there are overlapping sections, it is like the input is copied therefore there is not lost information in
throwing away parts of the linear convolution.
clc;
clear all;
close all;
x=input('enter input sequence:');
h=input('enter impulse sequence:');
L=input('Enter length of each block before appending zeros:');
Nx=length(x);
M=length(h);
M1=M-1;
R=rem(Nx,L);
N=L+M1;
x=[x zeros(1,L-R)];
h=[h zeros(1,N-M)];
K=floor(Nx/L); %no.of blocks
y=zeros(K+1,N);
z=zeros(1,M1);
%dividing the sequence into k blocks
for k=0:K
xp=x(L*k+1: L*k+L);
xk=[xp z];
Raghu Institute of Technology (Autonomous), Dakamarri , Visakhapatnam 23
Department of Electronics & Communication Engineering Digital Signal Processing Lab
y(k+1,:) =(cconv(xk,h,N));
end
yp=y';
[x,y]=size(yp);
for i=L+1:x
for j=1:y-1
temp1=i-L;
temp2=j+1;
temp3=yp(temp1,temp2)+yp(i,j);
yp(temp1,temp2)=temp3;
end
end
z=1;
for j=1:y
for i=1:x
if((i<=L & j<=y-1) | (j==y))
ypnew(z)=yp(i,j);
z=z+1;
end
end
end
y=ypnew;
disp('The output of x(n) convolution with h(n) in overlap add method is y(n)= ')
disp(y);
subplot(2,2,1)
stem(x);
xlabel('n --->')
ylabel('x(n) --->')
title('INPUT SEQUENCE x(n)')
subplot(2,2,2)
stem(h);
xlabel('n --->')
ylabel('h(n) --->')
title('IMPULSE SEQUENCE h(n)')
subplot(2,2,3)
stem(y);
xlabel('n --->')
ylabel('y(n) --->')
title('OUTPUT SEQUENCE y(n)')
INPUT:
enter input sequence:
enter impulse sequence:
Enter length of each block before appending zeros:
OUTPUT:
The output of x(n) convolution with h(n) in overlap add method is y(n)=
INPUT:
enter input sequence:
enter impulse sequence:
Enter length of each block before appending zeros:
OUTPUT:
The output of x(n) convolution with h(n) in overlap save method is y(n)=
RESULT:
VIVA QUESTIONS:
1. Explain the significance of convolution.
2. Define linear convolution.
3. Give the properties of linear convolution.
4. What is overlap-add method?
5. What is overlap-save method?
6. Give the differences between overlap-add and overlap-save methods?
7. What is need of discrete Fourier Transform?
8. Write down the mathematical expression to perform DFT?
9. How linear convolution will be used in calculation of LTI system response?
10. How the linear convolution will be used to calculate the DFT of a signal?
EXPERIMENT NO:4
N-POINT DFT
AIM:
To write a MATLAB code to compute N-point DFT of a given sequence and to plot magnitude and phase
spectrum.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
Discrete Fourier Transform is the transformation used to represent the finite duration frequencies. DFT
of a discrete sequence x(n) is obtained by performing sampling operations in both time domain and
frequency domain. It is the frequency domain representation of a discrete digital signal. The DFT of a
sequence x (n) of length N is given by the following equation,
subplot(2,2,2);
stem(n,magnitude);
xlabel('k ---->');
ylabel('Amplitude ---->');
title('magnitude response X(k) ---->');
phase = angle(xk); %Find the phases of individual DFT points
disp('Phase = ');
disp(phase);
%code block to plot the Phase Response
n = 0:N-1;
subplot(2,2,3);
stem(n,phase) ;
xlabel('k ---->');
ylabel('Phase response ---->');
title('Phase Response');
INPUT:
Number of DFT points =
Enter the sequence x(n) =
OUTPUT:
DFT of the sequence=
magnitude =
Phase =
RESULT:
VIVA QUESTIONS:
1. What is need of discrete Fourier Transform?
2. What is the difference between DFT and IDFT?
3. How to calculate output of DFT using MATLAB?
4. Give the defining equation for performing circular convolution using DFT.
5. Define signal, Give Examples for 1-D, 2-D, 3-D signals.
6. Define transform. What is the need for transform?
7. Differentiate DFT and DTFT
8. Explain mathematical formula for calculation of DFT.
9. What is meant by magnitude plot, phase plot, power spectrum?
10. Explain the applications of DFT.
EXPERIMENT NO:5
DECIMATION IN TIME RADIX-2 FFT ALGORITHM
AIM:
To write a MATLAB code to perform DFT using decimation in time radix-2 FFT algorithm.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
The Fast Fourier transform (FFT) is a method(or algorithm) for computing the DFT with reduced number
of calculations.
In radix-2 FFT the N point sequence is decimated into 2 point sequences and the 2 point DFT for each
decimated sequence is calculated. From the results of 2 point DFTs, the 4 point DFTs can be calculated.
From the results of 4 point DFTs, the 8 point DFTs can be calculated, and so on until we get N point DFT.
For DFT:
For FFT:
In DIT-FFT algorithm the time domain sequence x(n) is decimated whereas in DIF-FFT the frequency
domain sequence X(k) is decimated.
clc;
clear all;
close all;
x=input('Enter the sequence : ');
N=input('Enter the Point : ');
n=length(x);
x=[x zeros(1,N-n)];
y=bitrevorder(x);
M=log2(N);
for m=1:M
d=2^m;
for l=1:d:N-d+1
for k=0:(d/2)-1
w=exp(-1i*2*pi*k/d);
z1=y(l+k);
z2=y(l+k+d/2);
y(l+k)=z1+w*z2;
y(l+k+d/2)=z1-w*z2;
end
end
end
disp(“The DFT of a given sequence using radix-2 DIT-FFT is “)
disp(y);
subplot(3,1,1)
stem(abs(x));
title('Input Sequence');
subplot(3,1,2)
stem(abs(y));
title('Magnitude Response');
subplot(3,1,3)
stem(angle(y));
title('Phase Response');
INPUT:
Enter the sequence:
Enter the Point:
OUTPUT:
The DFT of a given sequence using radix-2 DIT-FFT is:
RESULT:
VIVA QUESTIONS:
1. What is decimation in time algorithm?
2. What is meant by bit reversed order?
3. Differentiate DFT and DTFT.
4. What are the advantages of FFT over DFT?
5. Differentiate DIT-FFT and DIF-FFT algorithms.
6. What is meant by radix?
7. What is meant by twiddle factor and give its properties?
8. How FFT is useful to represent a signal?
9. Compare FFT and DFT with respect to number of calculations required?
10. How is the original signal reconstructed from the FFT of a signal?
EXPERIMENT NO:6
DECIMATION IN FREQUENCY RADIX-2 FFT ALGORITHM
AIM:
To write a MATLAB code to perform DFT using decimation in frequency radix-2 algorithm.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
The fast Fourier transform (FFT) is a method(or algorithm) for computing the DFT with reduced number
of calculations.
In radix 2 FFT the N point sequence is decimated into 2 point sequences and the 2 point DFT for each
decimated sequence is calculated. From the results of 2 point DFTs, the 4 point DFTs can be calculated.
From the results of 4 point DFTs, the 8 point DFTs can be calculated, and so on until we get N point DFT.
For DFT:
For FFT:
In DIT-FFT algorithm the time domain sequence x(n) is decimated whereas in DIF-FFT the frequency
domain sequence X(k) is decimated.
clc;
clear all;
close all;
X=input('Enter the sequence : ');
N=input('Enter the Point : ');
n=length(X);
x=[X zeros(1,N-n)];
M=log2(N);
for m=1:M
d=2^(M-m+1);
for l=1:d:(N-d+1)
for k=0:(d/2)-1
w=exp(-1i*2*pi*k/d);
z1=x(l+k);
z2=x(l+k+d/2);
x(l+k)=z1+z2;
x(l+k+d/2)=(z1-z2)*w;
end
end
end
y=bitrevorder(x);
disp(y)
subplot(3,1,1)
stem(abs(X));
title('Input Sequence');
subplot(3,1,2)
stem(abs(y));
title('Magnitude Response');
subplot(3,1,3)
stem(angle(y));
title('Phase Response');
INPUT:
Enter the sequence:
Enter the Point:
OUTPUT:
The DFT of a given sequence using radix-2 DIF-FFT is:
RESULT:
VIVA QUESTIONS:
1. What is decimation in frequency algorithm?
2. What is meant by bit reversed order?
3. Differentiate DFT and DTFT.
4. What are the advantages of FFT over DFT?
5. Differentiate DIT-FFT and DIF-FFT algorithms.
6. What is meant by radix?
7. What is meant by twiddle factor and give its properties?
8. How FFT is useful to represent a signal?
9. Compare FFT and DFT with respect to number of calculations required?
10. How is the original signal reconstructed from the FFT of a signal?
EXPERIMENT NO:7
IIR -LOW PASS FILTER AND HIGH PASS FILTER
AIM:
To write a MATLAB code to design Butterworth IIR Low Pass Filter and High Pass Filter
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
IIR filter is also known as Recursive filter, which will have at least one feedback path in its structure. This
feedback path is due to presence of a pole. A Butterworth filer will have flat-flat response in both bands
i.e., Pass band and stop bands.
For a Low pass filter, the pass band frequency so is lesser than that of stop band frequency. We can
provide max attenuation in the stop band gain but very little attenuation in the pass band gain. A proper
order of the filter has to be chosen so as to match with the ideal frequency response.
For a High pass filter, we will have stop band first, later provide pass band frequency so that it is lesser
than that of stop band frequency. We can provide max attenuation in the stop band gain but very little
attenuation in the pass band gain. A proper order of the filter has to be chosen so as to match with the
ideal frequency response.
clc;
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 ripple,rp= ');
rs=input('Enter the stop band ripple, rs= ');
f=input ('Enter the sample frequency= ');
wp=2*fp;
ws=2*fs;
w1=wp/f;
w2=ws/f;
[N,WN]=buttord(w1,w2,rp,rs);
[B,A]=butter(N,WN,'LOW');
w=0:0.01:pi;
[H1,om]=freqz(B,A,w);
m=20*log10(abs(H1));
an=angle(H1);
subplot(2,1,1);
plot(om/pi,m);
xlabel(' (a) Normalised frequency');
ylabel(' Gain in dB');
title('MAGNITUDE RESPONSE OF BUTTERWORTH IIR LPF');
grid;
subplot(2,1,2);
plot(om/pi,an);
xlabel(' (b) Normalised frequency');
ylabel(' Phase in radians');
INPUT:
Enter the pass band frequency, fp=
Enter the stop band frequency, fs=
Enter the pass band ripple,rp=
Enter the stop band ripple, rs=
Enter the sample frequency=
OUTPUT:
clc;
clear all;
close all;
fp=input('Enter the pass band frequency, fp= ');
INPUT:
Enter the pass band frequency, fp=
Enter the stop band frequency, fs=
Enter the pass band ripple,rp=
Enter the stop band ripple, rs=
OUTPUT:
RESULT:
VIVA QUESTIONS:
1. What is an IIR filter?
2. How many types of IIR filters are there?
3. What is a Butterworth filter?
4. Name some techniques that convert analog filters into digital?
5. What are the inputs we provide for designing a filter?
6. Give the formula for order of the Butterworth filter?
7. How to find output of IIR filter for long input sequence?
8. Why IIR filters are called as recursive filters?
9. What are the advantages of IIR filters (compared to FIR filters)?
10. How to find out the order of a filter
EXPERIMENT NO:8
FIR -LOW PASS FILTER AND HIGH PASS FILTER
AIM:
To write a MATLAB code to design FIR Low Pass Filter and High Pass Filter using windowing
Techniques.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
FIR filters are digital filters with finite impulse response. They are also knownas non-recursive digital
filters as they do not have the feedback.
Firstly, there is no feedback loop in the structure of an FIR filter. Due to not having a feedback loop, an
FIR filter is inherently stable. For an IIR filter, the stability need to be checked.
Secondly, an FIR filter can provide a linear-phase response. A linear-phase response is the main advantage
of an FIR filter over an IIR design otherwise, for the same filtering specifications; an IIR filter will lead
to a lower order.
An FIR filter is designed by finding the coefficients and filter order that meet certain specifications, which
can be in the time-domain (e.g. a matched filter) and/or the frequency domain (most common). Matched
filters perform a cross-correlation between the input signal and a known pulse-shape. The FIR convolution
is a cross-correlation between the input signal and a time-reversed copy of the impulse-response.
Therefore, the matched-filter's impulse response is "designed" by sampling the known pulse-shape and
using those samples in reverse order as the coefficients of the filter.
When a particular frequency response is desired, several different design methods are common:
In the window design method, one first designs an ideal IIR filter and then truncates the infinite impulse
response by multiplying it with a finite length window function. The result is a finite impulse response
filter whose frequency response is modified from that of the IIR filter.
clc;
clear all;
close all;
rp=input('Enter passband ripple =');
rs=input('Enter the stopband ripple=');
fp=input('Enter passband frequency'=);
fs=input('Enter stopband frequency=');
f=input('Enter sampling frequency =');
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
c=input('Enter your choice of window function 1. rectangular 2. triangular 3.kaiser: \n ');
if(c==1)
y=rectwin(n1);
disp('Rectangular window filter response');
end
if (c==2)
y=triang(n1);
disp('Triangular window filter response');
end
if(c==3)
y=kaiser(n1,beta);
disp('kaiser window filter response');
end
%LPF
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(o/pi,m);
title('LPF');
ylabel('Gain in dB-->');
xlabel('(a) Normalized frequency-->');
subplot(2,1,2);
plot(o/pi,an);
title('LPF');
ylabel('phase-->');
xlabel('(a) Normalized frequency-->');
INPUT
Enter passband ripple =
Enter the stopband ripple =
Enter passband frequency =
Enter stopband frequency =
Enter sampling frequency =
Enter beta value =
Enter your choice of window function 1. rectangular 2. triangular 3.kaiser :
OUTPUT:
1.Rectangular window filter response
clc;
clear all;
close all;
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
if(c==1)
y=rectwin(n1);
end
if (c==2)
y=triang(n1);
end
if(c==3)
y=kaiser(n1,beta);
end
%HPF
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
plot(o/pi,m);
title('HPF');
ylabel('Gain in dB-->');
INPUT:
OUTPUT:
RESULT:
VIVA QUESTIONS:
1. What is a FIR filter?
2. In which filters, can we expect linear phase characteristics?
3. What is the pass band frequency? Explain?
4. What is the stop band frequency? Explain?
5. What is frequency response and explain?
6. What is impulse response? Give its significance.
7. Define a low pass filter?
8. What is the cut off frequency? Explain?
9. What are windowing techniques in FIR filter?
10. Why do we use windowing techniques?
EXPERIMENT NO:9
DECIMATION AND INTERPOLATION PROCESS
AIM:
TOOLS REQUIRED:
THEORY:
The process of converting the sampling rate of a signal from one rate to another is called sampling rate
conversion (SRC). This technique is encountered in many application areas such as:
Sampling rate may be changed upward or downward. Increasing the sampling rate is called interpolation
and decreasing the sampling rate is called decimation. Reducing the sampling rate by a factor of M is
achieved by discarding every M-1 samples or equivalently keeping every Mth sample. Increasing the
sampling rate by a factor of L(Interpolation by factor L ) is achieved by inserting L-1 zeros into the output
stream after every sample from the input stream of samples.
The most immediate reason to decimate is simply to reduce the sampling rate at the output of one system
so that another system operating at a lower sampling rate can be the input the signal. But a much more
common motivation for decimation is to reduce the cost of processing. The calculation and/or memory
required to implement a DSP system generally is proportional to the sampling rate, so the use of a lower
sampling rate usually results ina cheaper implementation.
The primary reason to interpolate is simply to increase the sampling rate at the output of one system so
that another system operating at a higher sampling rate can be the input the signal.
clear all;
close all;
n=0:L-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=decimate(x,D,'fir');
subplot(2,1,1);
stem(n,x(1:L));
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2);
m=0:(L/D)-1;
stem(m,y(1:L/D));
title('Decimated sequence');
xlabel('time(n)');
ylabel('amplitude');
INPUT:
OUTPUT:
close all;
N=input('enter the length of the input signal:'); %Length should be greater than 8
Raghu Institute of Technology (Autonomous), Dakamarri , Visakhapatnam 56
Department of Electronics & Communication Engineering Digital Signal Processing Lab
n=0:N-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=interp(x,L);
subplot(2,1,1);
stem(n,x(1:N));
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2);
m=0:N*L-1;
stem(m,y(1:N*L));
title('output sequence');
xlabel('time(n)');
ylabel('amplitude');
INPUT:
OUTPUT:
RESULT:
VIVA QUESTIONS:
1. Explain about multi rate digital signal processing.
2. List the Applications of multi rate digital signal processing.
3. Define interpolation.
4. Define decimation.
5. Define aliasing?
6. What is meant anti-aliasing?
7. What is the effect of anti-imaging filter?
8. What is meant by zero stuffing?
9. What is upsampling and downsampling?
10. What is the need of multi rate signal processing?
EXPERIMENT NO:10
I/D SAMPLING RATE CONVERSION
AIM:
To write a MATLAB code to implement the I/D sampling rate conversion.
TOOLS REQUIRED:
Computer, MATLAB Software.
THEORY:
"Multirate" means "multiple sampling rates". A multirate DSP system uses multiple sampling rates within
the system. Whenever a signal at one rate has to be usedby a system that expects a different rate, the
rate has to be increased or decreased, and some processing is required to do so. Therefore "Multirate DSP"
refers to the art or science of changing sampling rates. "Resampling" means combining interpolation and
decimation to change the sampling rate by a rational factor. Resampling is done to interface two systems
with different sampling rates.
BLOCK DIAGRAM OF SAMPLING RATE CONVERSION:
clc;
clear all;
close all;
n=0:N-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=resample(x,L,D);
subplot(2,1,1);
stem(n,x(1:N));
title('inputsequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2);
m=0:N*L/D-1;
stem(m,y(1:N*L/D));
title('outputsequence');
xlabel('time(n)');
ylabel('amplitude');
INPUT:
OUTPUT:
RESULT:
VIVA QUESTIONS:
1. Explain about multi rate digital signal processing.
2. List the Applications of multi rate digital signal processing.
3. Define interpolation.
4. Define decimation.
5. Define aliasing.
6. What is meant anti-aliasing?
7. What is the effect of anti-imaging filter?
8. Define sampling rate.
9. What is the use of sampling rate convertors?
10. Explain advantages of anti-aliasing filters
The C6713 DSK has a TMS320C6713 DSP onboard that allows full-speed verification ofcode
with Code Composer Studio. The C6713 DSK provides:
A USB Interface
SDRAM and ROM
An analog interface circuit for Data conversion (AIC)
An I/O port
Embedded JTAG emulation support
Connectors on the C6713 DSK provide DSP external memory interface (EMIF) and peripheral
signals that enable its functionality to be expanded with custom or third party daughter boards. The
DSK provides a C6713 hardware reference design that can assist you in the development of your
own C6713-based products. In addition to providing a reference for interfacing the DSP to various
types of memories and peripherals, the design also addresses power, clock, JTAG, and parallel
peripheral interfaces.
The C6713 DSK includes a stereo codec. This analog interface circuit (AIC) has the following
characteristics:
High-Performance Stereo Codec
Core Voltages
The 6713 DSK is a low-cost standalone development platform that enables customers to evaluate
and develop applications for the TI C67XX DSP family. The DSK also serves as a hardware
reference design for the TMS320C6713 DSP. Schematics, logic equations and application notes are
available to ease hardware development and reduce time to market. The DSK uses the 32-bit EMIF
for the SDRAM (CE0) and daughter card expansion interface (CE2 and CE3). The Flash is attached
to CE1 of the EMIF in 8-bit mode.
An on-board AIC23 codec allows the DSP to transmit and receive analog signals. McBSP0 is used
for the codec control interface and McBSP1 is used for data. Analog audio I/O is done through
four 3.5mm audio jacks that correspond to microphone input, line input, line output and headphone
output. The codec can select the microphone or the line input as the active input. The analog
output is driven to both the line out (fixed gain) and headphone (adjustable gain) connectors.
McBSP1 can be re-routed to the expansion connectors in software.
A programmable logic device called a CPLD is used to implement glue logic that ties the board
components together. The CPLD has a register based user interface that lets the user configure
the board by reading and writing to the CPLD registers. The registers reside at the midpoint of
CE1.The DSK includes 4 LEDs and 4 DIP switches as a simple way to provide the user with
interactive feedback. Both are accessed by reading and writing to the CPLD registers.
An included 5V external power supply is used to power the board. On-board voltage regulators
provide the 1.26V DSP core voltage, 3.3V digital and 3.3V analog voltages. A voltage supervisor
monitors the internally generated voltage, and will hold the boards in reset until the supplies are
within operating specifications and the reset button is released. If desired JP1 and JP2 can be used
as power test points for the core and I/O power supplies. Code Composer communicates with the
DSK through an embedded JTAG emulator with a USB host interface. The DSK can also be
used with an external emulator through the external JTAG connector.
TMS320C6713 DSP Features:
Highest-Performance Floating-Point Digital Signal Processor (DSP):
Eight 32-Bit Instructions/Cycle
32/64-Bit Data Word
300-, 225-, 200-MHz (GDP), and 225-, 200-, 167-MHz (PYP) Clock Rates
3.3-, 4.4-, 5-, 6-Instruction Cycle Times
2400/1800, 1800/1350, 1600/1200, and 1336/1000 MIPS /MFLOPS
Rich Peripheral Set, Optimized for Audio
Highly Optimized C/C++ Compiler
Extended Temperature Devices Available
Advanced Very Long Instruction Word (VLIW) TMS320C67x™ DSP Core
Eight Independent Functional Units:
Two ALUs (Fixed-Point)
Four ALUs (Floating- and Fixed-Point)
Two Multipliers (Floating- and Fixed-Point)
Load-Store Architecture With 32 32-Bit General-Purpose Registers
Instruction Packing Reduces Code Size
Up to 16 transmit pins
Enhanced Channel Status/User Data
Extensive Error Checking and Recovery
Two Inter-Integrated Circuit Bus (I2C Bus™) Multi-Master and Slave
Interfaces
Two Multichannel Buffered Serial Ports:
Serial-Peripheral-Interface (SPI)
High-Speed TDM Interface
AC97 Interface
Two 32-Bit General-Purpose Timers
Dedicated GPIO Module With 16 pins (External Interrupt Capable)
Flexible Phase-Locked-Loop (PLL) Based Clock Generator Module
IEEE-1149.1 (JTAG ) Boundary-Scan-Compatible
APPLICATIONS OF DSP:
Digital signal processors are used for a wide range of applications, from communications
and controls to speech and image processing.
Telecommunications
Control systems
Instrumentation
Image processing
Military
Medical
Networking
Code Composer Studio™ (CCS or CC Studio) is the integrated development environment for TI's
DSPs, microcontrollers and application processors. CC Studio includes a suite of tools used to
develop and debug embedded applications. It includes compilers for each of TI's device families,
source code editor, project build environment, debugger, profiler, simulators and many other
features. CC Studio provides a single user interface taking users through each step of the application
development flow. Familiar tools and interfaces allow users to get started faster than ever before
and add functionalityto their application thanks to sophisticated productivity tools.
CC Studio version 4 (CCSv4) is based on the Eclipse open source software framework. CCSv4 is
based on Eclipse because it offers an excellent software framework for development environments
a standard framework many embedded software vendors. CCSv4 combines the advantages of the
Eclipse software framework with advanced embedded debug capabilities from TI resulting in a
compelling feature rich development environment for embedded developers.
FEATURES:
DEBUGGER:
CCStudio's integrated debugger has several capabilities and advanced breakpoints to simplify
development. Conditional or hardware breakpoints are based on full C expressions, local variables
or registers. The advanced memory window allows you to inspect each level of memory so that you
can debug complex cache coherency issues. CCStudio supports the development of complex
systems with multiple processors or cores. Global breakpoints and synchronous operations provide
control over multipleprocessors and cores.
PROFILING:
CCStudio's interactive profiler makes it easy to quickly measure code performance and ensure the
efficient use of the target's resources during debug and development sessions. The profiler allows
developers to easily profile all C/C++ functions in their application for instruction cycles or other
events such as cache misses/hits, pipeline stalls and branches.
Profile ranges can be used to concentrate efforts on high-usage areas of code during optimization,
helping developers produce finely-tuned code. Profiling is available for ranges of assembly, C++ or
C code in any combination. To increase productivity, all profiling facilities are available throughout
the development cycle.
SCRIPTING:
Some tasks such as testing need to run for hours or days without user interaction. To accomplish
such a task, the IDE should be able to automate common tasks. CCStudio has a complete scripting
environment allowing for the automation of repetitive tasks such as testing and performance
benchmarking. A separate scripting console allows you to type commands or to execute scripts
within the IDE.
CCStudio has many image analysis and graphic visualization. It includes the ability to graphically
view variables and data on displays which can be automatically refreshed. CCStudio can also look
at images and video data in the native format (YUV, RGB) both in the host PC or loaded in the
target board.
COMPILER:
TI has developed C/C++ compilers specifically tuned to maximize the processor's usage and
performance. TI compilers use a wide range of classical, application-oriented, and sophisticated
device-specific optimizations that are tuned to all the supported architectures.
assembly program developer who has the full system view. This application level view is leveraged
by the compiler to make trade-offs that significantly increase the processor performance.
The TI ARM and Microcontroller C/C++ compilers are specifically tuned for code size and control
code efficiency. They offer industry leading performance and compatibility.
SIMULATION:
Simulators provide a way for users to begin development prior to having access to a development
board. Simulators also have the benefit of providing enhanced visibility into application
performance and behaviour. Several simulator variants are available allowing users to trade off
cycle accuracy, speed and peripheral simulation, with some simulators being ideally suited to
algorithm benchmarking and others for more detailed system simulation
EXPERIMENT NO:11
MAC OPERATION USING VARIOUS ADDRESSING MODES
USING DSP PROCESSOR
AIM:
To perform MAC operation using various addressing modes of TMS320C6713 DSP processor.
TOOLS REQUIRED:
Computer, DSP Processor, CC studio software.
THEORY:
Addressing Modes of The TMS320C6713 DSP supports three types of addressing modes that enable
flexible access to data memory, to memory-mapped registers, to register bits, and to I/O space:
The absolute addressing mode allows to reference a location by supplying all or part of an
address as a constant in an instruction.
The direct addressing mode allows to reference a location using an address offset.
The indirect addressing mode allows to reference a location using a pointer.
Each addressing mode provides one or more types of operands. An instruction that supports an
addressing-mode operand has one of the following syntax elements listed below.
Baddr:
When an instruction contains Baddr, that instruction can access one or two bits in an accumulator
(AC0–AC3), an auxiliary register (AR0–AR7), or a temporary register (T0–T3). Only the register bit
test/set/clear/complement instructions support Baddr.
Cmem:
When an instruction contains Cmem, that instruction can access a single word (16 bits)of data from
data memory..
Lmem:
When an instruction contains Lmem, that instruction can access a long word (32 bits) of data from
data memory or from a memory-mapped registers.
Smem:
When an instruction contains Smem, that instruction can access a single word (16 bits) of data from
data memory, from I/O space, or from a memory-mapped register. As you write the instruction, replace
Smem with a compatible operand.
AR indirect
This mode uses one of eight auxiliary registers (AR0–AR7) to point to data. The way the CPU
uses the auxiliary register to generate an address depends on whether accessing data space (memory
or memory-mapped registers), individual register bits, or I/O space.
Dual AR indirect
This mode uses the same address-generation process as the AR indirect addressing mode. This
mode is used with instructions that access two or more data-memory locations.
CDP indirect
This mode uses the coefficient data pointer (CDP) to point to data. The way the CPU uses CDP
to generate an address depends on whether accessing data space (memory or memory-mapped
registers), individual register bits, or I/O space.
Coefficient indirect
This mode uses the same address-generation process as the CDP indirect addressing mode. This
mode is available to support instructions that can access a coefficient in data memory at the same time
they access two other data-memory values using the dual AR indirect addressing mode.
Circular Addressing
Circular addressing can be used with any of the indirect addressing modes. Each of the eight
auxiliary registers (AR0–AR7) and the coefficient data pointer (CDP) can be independently
configured to be linearly or circularly modified as they act as pointers to data or to register bits.
This configuration is done with a bit (ARnLC) in status register ST2_67.
ADDITION:
INP1 .SET 0H
INP2 .SET 1H
OUT .SET 2H
.mmregs
.text
START:
LD
#140H,DP
RSBX CPL
NOP
NOP
NOP
NOP
LD INP1,A
ADD INP2,A
STL A,OUT
HLT: B HLT
INPUT:
Data Memory:
OUTPUT:
Data Memory:
SUBTRACTION:
INP1 .SET 0H
INP2 .SET 1H
OUT .SET 2H
.mmregs
.text
START:
LD #140H,DP
RSBX CPL
NOP
NOP
NOP
NOP
LD INP1,A
SUB INP2,A
STL A,OUT
HLT: B HLT
INPUT:
Data Memory:
OUTPUT:
Data Memory:
RESULT:
VIVA QUESTIONS:
1. What are the features of TMS320C6713 DSP?
2. What is the fastest member of the tms320c67xx family?
3. Which CPU architecture is fastest?
4. What is TMS 320 explain its architecture?
5. How many functional units are there in tms320c6x processor?
6. What is the total memory space of tms320c6x?
7. What is the memory architecture of DSP processor?
8. Which software tool is required to compile and run DSP assembly language program.
9. What are the applications of TMS320 DSP’s?
10. What is the difference between von neumann architecture and Harvard architecture?
EXPERIMENT NO:12
UP-SAMPLING AND DOWN-SAMPLING IN DSP PROCESSOR
AIM:
To perform the Decimation of given discrete sequence in TMS320C6713 KIT
TOOLS REQUIRED:
Computer, CCS v4,TMS320C6713 KIT,USB Cable,5V Adapter
THEORY:
Multi-rate signal processing studies digital signal processing systems which include sample rate
conversion. Multirate signal processing techniques are necessary for systems with different input
and output sample rates but may also be used to implement systems with equal input and output
rates.
DECIMATION:
The process of changing the sampling rate of a signal (resampling) is called downsampling if the
sample rate is decreased and upsampling if the sample rate is increased. Integer rate changes are
far more common than non-integer rate changes. In signal processing, downsampling (or
“subsampling”) is the process of reducing the sampling rate of a signal. This is usually done to
reduce the data rate or the size of the data. The downsampling factor (commonly denoted by M)
is usually an integer or a rational fraction greater than unity. This factor multiplies the sampling
time or, equivalently, divides the sampling rate.
INTERPOLATION:
The process of changing the sampling rate of a signal (resampling) is called downsampling if the
sample rate is decreased and upsampling if the sample rate is increased. Integer rate changes are
far more common than non-integer rate changes. Interpolation is a method of constructing new
data points within the range of a discrete set of known data points. Upsampling is the process of
increasing the sampling rate of a signal. For instance, upsampling raster images such as
photographs means increasing the resolution of the image.The upsampling factor (commonly
denoted by L) is usually an integer or a rational fraction greater than unity. This factor multiplies
the sampling rate or, equivalently, divides the sampling period.
y[i] = x[j];
j = j+b;
}
d = a/b;
z = round(d);
for(i=1;i<=z;i++)
printf("\n The first order decimation values are y[%d]=%d",i,y[i]);
printf( "\n***ALL Tests Passed***\n" );
}
INPUT:
Enter the No of input vector: ⇒ Enter.
Enter sampling value: ⇒ Enter.
Enter values for i/p x(n): – ⇒ Enter.
OUTPUT:
scanf(“%d”,&tb);
printf(“Enter values for i/p x(n):\n”);
for(ti=1;ti<=ta;ti++)
scanf(“%d”,&tx[ti]);
tc = tb -1;
txx = 0;
for (ti=1;ti<=ta;ti++)
{
ty[ti+txx] = tx[ti];
tcc = ti+txx
tz = ti;
for (tj = 1 ;tj<=tc ;tj++)
{
ty[tcc+1] = 0;
ti = ti+1;
tcc =tcc+1;
}
txx = tcc-tz;
ti = ti-tc;
}
td = ta*tb;
for(ti=1;ti<=td;ti++)
printf(“\n The Value of output ty[%d=%d’,ti,ty[ti]);
printf(“\n***ALL Tests Passed***\n” );
}
INPUT:
OUTPUT:
The Value of output ty[1]=
Raghu Institute of Technology (Autonomous), Dakamarri , Visakhapatnam 80
Department of Electronics & Communication Engineering Digital Signal Processing Lab