Sodapdf Converted Merged
Sodapdf Converted Merged
DEPARTMENT OF MATHEMATICS
SUBMITTED TO:
TABLE OF CONTENT
S.NO TOPIC DATE
WHAT IS MATLAB ?
MATLAB combines a desktop environment
tuned for iterative analysis and design
processes with a programming language that
expresses matrix and array mathematics
directly. It includes the Live Editor for creating
scripts that combine code, output, and
formatted text in an executable notebook.
MATLAB toolboxes are professionally
developed, rigorously tested, and fully
documented.
MATLAB apps let you see how different
algorithms work with your data. Iterate until
you’ve got the results you want, then
automatically generate a MATLAB program to
reproduce or automate your work.
What Can I Do With MATLAB?
• Analyze data
• Develop algorithms
• Create models and applications
MATLAB lets you take your ideas from research to
production by deploying to enterprise applications and
embedded devices, as well as integrating with
Simulink and Model-Based Design.
1. LINSPACE
linspace is similar to the colon operator, “ : ”, but gives direct control over the number
of points and always includes the endpoints.
2.PLOT
Plot. The plot() function is used to draw points (markers) in a diagram.
The function takes parameters for specifying points in the diagram.
Parameter 1 specifies points on the x-axis.
Syntax :
plot(X,Y)
plot(X,Y,LineSpec)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
plot(Y)
plot(Y,LineSpec)
plot(tbl,xvar,yvar)
plot(tbl,yvar)
plot(ax,___)
plot(___,Name,Value)
p = plot(___)
3. Hold on
Use hold on to add a second line plot without deleting the existing line plot. The new
plot uses the next color and line style based on the ColorOrder and LineStyleOrder
properties of the axes.
4. Grid on
grid on adds grid lines to the current Axes. grid off removes grid lines
from the current Axes. grid toggles the grid visibility state. grid sets the
XGrid , YGrid , and ZGrid properties of the current Axes.
5. Meshgrid
meshgrid(x,y) returns 2-D grid coordinates based on the coordinates contained in
vectors x and y. X is a matrix where each row is a copy of x, and Y is a matrix where
each column is a copy of y. The grid represented by the
coordinates X and Y has length(y) rows and length(x) columns.
[X,Y] = meshgrid(x)
[X,Y,Z] = meshgrid(x,y,z)
[X,Y,Z] = meshgrid(x)
6. Mesh
mesh(X,Y,Z) creates a mesh plot, which is a three-dimensional surface that has solid edge colors
and no face colors. The function plots the values in matrix Z as heights above a grid in the x-y plane
defined by X and Y. The edge colors vary according to the heights specified by Z.
syntax :- mesh(X,Y,Z)
mesh(Z)
mesh(Z,C)
mesh(___,C)
mesh(ax,___)
mesh(___,Name,Value)
s = mesh(___)
7. Axis equal
axis equal sets the aspect ratio so that the data units are the same in every direction. The
aspect ratio of the x-, y-, and z-axis is adjusted automatically according to the range of data
units in the x, y, and z directions.
8. colormap
colormap map sets the colormap for the current figure to the specified predefined colormap. For
example, colormap hot sets the colormap to hot.
If you set the colormap for the figure, then axes and charts in the figure use the same colormap. The
new colormap is the same length (number of colors) as the current colormap. When you use this
syntax, you cannot specify a custom length for the colormap. See the More About section for more
information about colormaps.
colormap(map)
colormap(target,map)
cmap = colormap(___)
cmap = colormap
cmap = colormap(target)
Result 3
Figure 1
Figure 2
Figure 3
Results 7
Figure 1
Figure 2
Figure 3
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1 -0.5 0 0.5 1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1 -0.5 0 0.5 1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1 -0.5 0 0.5 1
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1 -0.5 0 0.5 1