0% found this document useful (0 votes)
21 views8 pages

DSP Report Akshat

The document is a lab report submitted by Akshat Srivastava to Dr. Krishna Raj that summarizes experiments performed using MATLAB software. The objective was to plot different 2D plots. MATLAB is introduced as a technical computing language used for tasks like computation, modeling, and data visualization. Functions for creating matrices and plotting graphs are described. Four experiments are outlined demonstrating how to plot given data sets, functions, and derivatives on the same graph using MATLAB commands.

Uploaded by

Abhinav Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views8 pages

DSP Report Akshat

The document is a lab report submitted by Akshat Srivastava to Dr. Krishna Raj that summarizes experiments performed using MATLAB software. The objective was to plot different 2D plots. MATLAB is introduced as a technical computing language used for tasks like computation, modeling, and data visualization. Functions for creating matrices and plotting graphs are described. Four experiments are outlined demonstrating how to plot given data sets, functions, and derivatives on the same graph using MATLAB commands.

Uploaded by

Abhinav Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

HARCOURT BUTLER

TECHNICAL UNIVERSITY

DSP Lab Report

Submitted by:- Submitted to:-


Akshat Srivastava Dr. Krishna Raj
Roll no.: 200106026 Professor
Final Electronics Engineering Electronics Engg. department
H.B.T.U. Kanpur
EXPERIMENT-1

Objective: To plot the 2-dimensional different types of plots.


Software used: MATLAB R26B
Theory:
MATLAB stands for matrix laboratory. It is a supportive language for technical
computing.
It is used for various purposes:
• Math and computation
• Algorithm development
• Modeling, simulation and prototyping
• Data analysis, exploration and visualization
• Application development, including Graphical User Interface building etc.

Extension used to save files of simple text in MATLAB is (.m ) and in Simulink it
is (.mdl).
Tool box is a collection of functions built on the MATLAB technical computing
environment.

Functions that are used in MATLAB program:-


• We represent column matrix in MATLAB as,
Z= [3;4;5]
That means 3, 4, 5 are the first elements of consecutive rows or simply
we can say that elements of column matrix.
Hence its column matrix is= 3
4
5

• We can represent row matrix as,


Z=[3,4,5] or [3 4 5]
That means 3, 4, 5 are the elements of first row in a matrix.

• For multiplication of two matrices we use,


Z= X.*Y

where X and Y are two different matrices.


• To represent complete matrix we use,
A= [1,2,3;4,5,6;5,-6,1]
and the matrix representation of this is,
A= 1 2 3
4 5 6
5 -6 1

• mean(A) it is used to find mean of numbers in set A.


• C=max(A) it is used to find maximum of A.
• sum(A) it is used to find sum of a numbers in set A.
• sort(A) it is used for sorting of a numbers in A.
• Median(A) it is used to find a median of set A.
• std(A) it is used to find standard deviation of A.
• det(A) it is used to find a determinant of matrix A.
• inv(A) it is used to find a inverse matrix of a matrix A.
• dot(a,b) it is used to find dot product of two vectors a, b.
• cross(a,b) it is used to find the cross product of two vectors a, b.

The rand command:-


• rand used to generate single random no. between 0 & 1.
• rand(1,n) used to generate n random no.(row vector) b/w 0 & 1.
• rand(n) used to create square matrix (n x n).
• rand(m x n) used to create matrix of order n x m.

The resultant default plot we get in MATLAB is blue in colour with solid style
and no marker.
To change Marker, Style and Colour we have following options:-
Style Colour Marker

Solid (-) Red (r) Plus sign (+)


Dotted (:) Green (g) Circle (o)
Dashed (--) Blue (b) Asterisk (*)
Dash-dotted (-.) Black (k) Point (.)
Magenta (m) Square (s)
Cyan (c) Diamond (d)

plot(x,y) it is the function which is used to plot a graph b/w x and y.

1. Plot of given data:-


x : 1 2 3 5 7 7.5 8 10
y : 2 6.5 7 7 5.5 4 6 8

Sol. Code: x= [1 2 3 5 7 7.5 8 10];


y= [2 6.5 7 7 5.5 4 6 8];
plot(x,y)

fig:1

Other code: x= [1 2 3 5 7 7.5 8 10];


y= [2 6.5 7 7 5.5 4 6 8];
plot(x,y, ‘- -r’, ‘*’)
Fig:2

2. Plot a given function:-


y= 3.5^(-0.5x) cos6x for -2 < x < 4
Sol. % the function: 3.5^(-0.5x)*cos(6x)
x= [-2:0.01:4];

fig:3
y= 3.5.^(-0.5*x)*cos(6*x);plot(x,
y)
Other plot:
x= [-2:0.5:4];
y= 3.5.^(-0.5*x)*cos(6*x);
plot(x, y)

Fig:4

fplot(‘fxn’,limits) it is another function to plot a graph from its


given equation.

3. Plot the graph of y= x^2+4sin2x -1 for -3 < x < 3


Sol. Code: fplot(‘x.^2+4*sin(2*x)-1’ , [-3,3])

Fig:5
hold on, hold off this function is used to plot multiple graphs.
Let we have a multiple functions between x,y and u,v and t,h
We want to plot a graph y vs x, v vs u, h vs t,
For that we can use a direct function:

plot(x,y,’-b’,u,v,’- -r’,t,h,’:k’)
or we can use a hold on, hold off function

4. Plot a given function, its first derivative and its second derivative:
y=3x^3-26x+10 for -2 < x < 4
Sol. Code: x= [-2:0.01:4];
y= 3*x.^3-26*x+6;
yd= 9*x.^2-26;
ydd= 18*x;
plot(x,y,’-b’,x,yd,’- -r’,x,ydd,’-.k’)

Other code:
x= [-2:0.01:4];
y= 3*x.^3-26*x+6;
yd= 9*x.^2-26;
ydd= 18*x;
plot(x,y,’-b’)
hold on
plot(x,yd,’- -r’)
plot(x,ydd,’-.k’)
hold off

fig:6

Conclusion: Thus, we have obtained different types of 2-dimensional plots such as


simple trigonometric plots and different types of trigonometric plots
on x-and y-axis.

You might also like