DSP Final ABHI-libre
-
Upload
kshitij-gaur -
Category
Documents
-
view
223 -
download
0
Transcript of DSP Final ABHI-libre
-
8/11/2019 DSP Final ABHI-libre
1/26
SRI SAI INSTITUTE OF ENGG. AND TECHNOLOGY
MATLAB PRACTICAL FILE
ECE 316
Abhishek SharmaECE - 6t h Sem.
http://www.scribd.com/abeesharmahttp://www.scribd.com/abeesharmahttp://www.scribd.com/abeesharmahttp://www.scribd.com/abeesharmahttp://www.scribd.com/abeesharma -
8/11/2019 DSP Final ABHI-libre
2/26
TABLE OF CONTENTS
Inroduction To MATLAB __________________________________________________________________
Program For Impulse Function ___________________________________________________________
Program For Unit Step Function __________________________________________________________
Program For Unit Ramp Function _________________________________________________________
Program For Exponential Function ______________________________________________________
Program For Real Value Function ________________________________________________________
Program For Shifting Function ____________________________________________________________
Program For Addition Function ___________________________________________________________
Program For Multiplication Function ____________________________________________________
Program For Convolution Function ______________________________________________________
Program For Folding Function ____________________________________________________________
-
8/11/2019 DSP Final ABHI-libre
3/26
1
WHAT IS MATLAB? AN INTRODUCTION
)t stands for MATrix LAbORATORY )t is developed by The Mathworks )nc. )t is an interactive, integrated, environment For numerical computations For symbolic computations For scientific visualizations )t is a high level programming language Program runs in interpreted, as opposed to compiled, mode MATLAB is a high level technical computing language and interactive environment for
algorithm development, data visualization, data analysis and numeric computation. Usingthe MATLAB product, you can solve technical computing problems faster than thetraditional programming languages such as C, C++ and FORTRAN.
You can use MATLAB in a wide range of applications, including signal and image processing,communication, control design, test and measurement, financial modeling and analysis, andcomputational biology. Add on toolboxes collection of special purpose MATLAB functions,
available separately extend the MATLAB environment to solve particular classes ofproblems in these application areas.
MATLAB provides a number of features for documenting and sharing your work. You canintegrate your MATLAB code with other languages and applications, and distribute yourMATLAB algorithms and applications.
-
8/11/2019 DSP Final ABHI-libre
4/26
2
Characterstics Of MATLAB:
Programming Language Based principally On Matrices.
Slow compared with FORTRAN or C because it is an interpreted language, i.e not precompiled. Avoid for loops, instead use vector form whenever possible. Automatic memory management, i.e you dont have to declare arrays in advance. )ntuitive, easy to use. Compact array handling is Fortran 90like . Shorter program development time than traditional programming languages such as
FORTRAN and C. Can be converted into C code via MATLAB compiler for better efficiency. Many applications specific toolboxes available. Coupled with Maple for symbolic computations. On sharedmemory parallel computers such as the SG) Origin 000, certain operations
processed in parallel autonomously when computation load warrants.
KEY FEATURES :-
(igh level language for technical computing.
Development environment for managing code, files, and data. )nteractive tools for iterative exploration, design and problem solving. Mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization,
and numerical integration D and D graphical functions for visualizing data. Tools for building custom graphical user interfaces. Functions for integrating MATLAB based algorithm with external application and languages,
such as C, C++, FORTRAN, Java, and Microsoft Excel.
-
8/11/2019 DSP Final ABHI-libre
5/26
3
EXAMPLES:
Matrix computation and linear algebra.
Solving nonlinear equation. Numerical solution of differential equation. Mathematical optimization. Statistical and data analysis. Signal Processing. Modeling of dynamical systems. Solving partial differential equation. Simulation of Engg. Systems.
USES IN ENGG. COMPANIES:
Numerical analysis Signal and system. Modeling of dynamical systems. Automatic control.
BASIC COURSES:
Automatic control advanced course. (ybrid and embedded. Control system. Chemical process control. Control process control. Signal theory. Digital signal processing. Adaptive signal processing. Signal processing project. Communication theory. Advance communication theory.
-
8/11/2019 DSP Final ABHI-libre
6/26
4
Program - 1
To Develop Elementary Signal For Impulse Function
Program:
a=[ 2;1;2]
b=[zeros(1,2),ones(1,1),zeros(1,2)]
stem(a,b)
xlabel(a >) ylabel(amp >)
Result:
a= 2 1 0 1 2
b= 0 0 1 0 0
-
8/11/2019 DSP Final ABHI-libre
7/26
5
Graph For Impulse Function:
-
8/11/2019 DSP Final ABHI-libre
8/26
6
Program - 2
To Develop Elementary Signal For Unit Step Function
Program:
n=input(enter the value of n)
a=[1:1:n]
b=[ones,n]
subplotes
stem(a,b)
xlabel(n..>)
ylabel(amplitude)
Result of unit step function :
Enter the value of n
n=5
a=0 1 2 3 4
b= 1 1 1 1 1
-
8/11/2019 DSP Final ABHI-libre
9/26
7
Graph For Unit Step Function:
-
8/11/2019 DSP Final ABHI-libre
10/26
8
Program - 3
To Develop
Elementary
Signal
For
Unit
Ramp
Function
Program :
a=[2:1:8]
b=[0;1;6]
subplot
stem(a,b)
xlabel(n.)
ylabel(amp.)
Result of unit ramp function :
a=2 3 4 5 6 7 8
b= 0 1 2 3 4 5 6
-
8/11/2019 DSP Final ABHI-libre
11/26
9
Graph For Unit Ramp Function:
-
8/11/2019 DSP Final ABHI-libre
12/26
10
Program - 4
To Develop Exponential Function Of (Given) Sequence
Program :
n=input(enter the value of n)
a=input(enter the value of a)
t=[0:1:n]
y=exp(a*t)
subplot
stem(t,y)
xlabel(a)
ylabel(n)
Result of exponential: Enter the value of n10
n= 10
enter the value of a0.5
a= 0.5000
t=0 1 2 3 4 5 6 7 8 9 10
y=columns 1 through 10
1.0000 1.6487 2.7183 4.4817 7.3891 12.1825 20.0855 33.1155 54.5982 90.0171
Column11
148.4132
-
8/11/2019 DSP Final ABHI-libre
13/26
11
Graph For Exponential Function:
-
8/11/2019 DSP Final ABHI-libre
14/26
12
Program - 5
To Develop Elementary Signal For Real Value
Program:
n=[0,1,2,3,4,5]
a=[0.5]
y=a.^n
subplot
stem(n,y)
xlabel(n..)
ylabel(a)
Result of Real Value No. :
n= 0 1 2 3 4 5
a= 0.5000
y = 1.0000 0.5000 0.2500 0.1250 0.0625 0.0313
-
8/11/2019 DSP Final ABHI-libre
15/26
13
Graph For Real Value Function :
-
8/11/2019 DSP Final ABHI-libre
16/26
14
Program - 6
To Develop Elementary Signal For Shifting Program:
a=[ 3:1:3]
b=[1.2.3.2.1.1.2]
subplot(3,1,1)
stem(a,b)
xlabel(n >)
ylabel(amp >)
a=a
subplot(3,1,2)
stem(a,b)
xlabel(n >)
ylabel(amp >)
Result:
a = 3 2 1 0 1 2 3
b = 1 2 3 2 1 1 2
a = 3 2 1 0 1 2 3
-
8/11/2019 DSP Final ABHI-libre
17/26
15
Graph For Shifting Function:
-
8/11/2019 DSP Final ABHI-libre
18/26
16
Program - 7
To Develop Elementary Signal For Addition Of Two Sequences
Program:
n=[ 3:1:3]
b=[2,3,0,1,3,2,1]
subplot(5,1,1) stem(n,b) xlabel('n.>') ylabel('amplitude') title('input of signal b') a=[3,4,5,6,7,8,9] subplot(5,1,3) stem(n,b) ylabel('amplitude') title('input of signal a') z=b+a subplot(5,1,5) stem(n,a) xlabel('n.>') ylabel('amplitude') title('addition of two signal is z(n)')
Result of Addition:
2 3 0 1 3 2 1
a = 3 4 5 6 7 8 9
z = 5 7 5 7 10 10 10
-
8/11/2019 DSP Final ABHI-libre
19/26
17
Graph For Addition Function :
-
8/11/2019 DSP Final ABHI-libre
20/26
18
Program - 8
To Develop Elementary Signal For Multiplication Of Two
Sequences
Program:
n=[ 2:1:3] x=[1,2,3,4,5,6] subplot(3,1,1) stem(n,x) xlabel('n >') ylabel('amp >') y=[2] z=(x*y) subplot(3,1,2) stem(n,z) xlabel('n >') ylabel('amp >')
Result:
n = 2 1 0 1 2 3
x = 1 2 3 4 5 6
y = 2
z = 2 4 6 8 10 12
-
8/11/2019 DSP Final ABHI-libre
21/26
19
Graph For Multiplication Function:
-
8/11/2019 DSP Final ABHI-libre
22/26
20
Program - 9
To Develop The Elementary Signal For Convolution Of
Two Sequences
Program:
X=input(enter the value of x)
h=input(enter the value of h)
y=conv(x,h)
subplot(3,1,1)
stem(x)
xlabel(n.>)
ylabel(amplitude.>)
subplot(3,1,2)
stem(h)
xlabel(n.>)
ylabel(amplitude.>)
subplot(3,1,3)
stem(y)
xlabel(n.>)
ylabel(amplitude.>)
-
8/11/2019 DSP Final ABHI-libre
23/26
21
Result of convolution:
Enter the sequence of x[1,2]
X=1 2
Enter the sequence of h[1,2,3,4]
h = 1 2 3 4
y = 1 4 7 10 8
-
8/11/2019 DSP Final ABHI-libre
24/26
22
Graph For Convolution Function:
-
8/11/2019 DSP Final ABHI-libre
25/26
23
Program - 10
To Develop Elementary Signal For Folding
Program:
a=[ 3:1:3]
b=[1,2,3,2,1,1,2]
subplot(3,1,1)
stem(a,b) xlabel(n.. >)
ylabel(amp..>)
a= a
subplot(3,1,2)
stem(a,b)
xlabel(n..>)
ylabel(amp..>)
Result of Folding :
a= 3 2 1 0 1 2 3
b= 1 2 3 2 1 1 2
a= 3 2 1 0 1 2 3
-
8/11/2019 DSP Final ABHI-libre
26/26
24
Graph For Folding Function: