Internship Report: Navya Srivastava 1900520310040 Semester: 5th
Internship Report: Navya Srivastava 1900520310040 Semester: 5th
Navya Srivastava
1900520310040
Semester: 5th
Bachelor Of Technology
Electronics And Communication Engineering
Submission Date: 22nd December, 2021
MATLAB Training
MATLAB specializes in running Whether it is machine learning, Mathematical operations and code
mathematical operations, analyzing robotics, data science, IoT, or web are processed quickly allowing you
data, and testing scientific models. development, MATLAB is used to be more productive and test
It's a tool of choice for engineers everywhere. different models with ease.
and scientists.
Week 1 - Introduction
y = 8
Week 2-Foundations
● Writing Scripts
● Variables
● Arrays & Matrices
Writing scripts in MATLAB
The simplest type of MATLAB program is called a script. A script is a file that contains multiple
sequential lines of MATLAB commands and function calls. You can run a script by typing its
name at the command line.
Naming Variables
Variable names consist of a letter followed by any number of letters, digits or underscore.
MATLAB is case-sensitive.
Variable names can be of any length, however, MATLAB uses only first N characters, where N is given by
the function namelengthmax.
x6 6x
lastValue end
n_factorial n!
Working with Variables and Arrays in MATLAB zeros(n) Creates a n x n matrix
of zeros.
● Math Review
● Programming Math
MATLAB Arithmetic Operators
Arithmetic operators help in performing simple arithmetic operations like addition, subtraction, multiplication, division, and power.
+ Addition plus
Example
- Subtraction minus A = magic (3)
.* Element-wise multiplication times
A =
8 1 6
* Matrix multiplication mtimes 3 5 7
./ Element-wise right division rdivide 4 9 2
3 * A
.\ Element-wise left division ldivide ans=
/ Matrix right division mrdivide 24 3 18
9 15 21
\ Matrix left division mldivide
12 27 6
.^ Element-wise power power
● Plotting Data
● Type of Plots
● Advanced & 3D Plots
Generating Sub-Plots
We can use the subplot function to display
multiple plots in different sub-regions of
MATLAB Plotting the same window. The subplot commands
Plotting is a graphical representation of a data set that
require three integer arguments:
shows a relationship between two or more variables.
MATLAB plots play an essential role in the field of subplot (m, n, p)
mathematics, science, engineering, technology, and Splits the figure into an m x n matrix. The
finance for statistics and data analysis. variable p identifies the part of the window
There are several functions available in MATLAB to where the next plot will be drawn. For
create 2-dimensional and 3-dimensional plots. example, if the command
Creating Plotting
MATLAB makes it easy to create plots. For example in
2D, is to take a vector of a- coordinates, a = (a1... an ),
and a vector of b-coordinates, b = (b1...bn), locate the
points (ai...bi), with i = 1, 2. . . n and then connect them
by straight lines.
The MATLAB commands to plot a graph is plot (a, b).
MATLAB 3D Plots
MATLAB also includes a wide variety of
three-dimensional plots that can be
MATLAB 2-D Plots useful for displaying certain types of
There are many specific graphics data. In general, three-dimensional plots
functions for 2-D plotting. They are are helpful for displaying two types of
used as alternatives to the data:
plot command we have just discussed. Two variables that are functions of the
MATLAB help desk lists more than 20 same independent variable, when you
types of two-dimensional plots. wish to emphasize the importance of the
Examples include stem plots, stair plots,
independent variable.
bar plots, pie plots, and compass plots.
A single variable that is a function of two
Here we are going to discuss the 2D
independent variables, z = f (x, y).
plotting function in MATLAB.
Week 5- Programming
● Core Logic
● Loops & Statements
MATLAB nested if-else
Syntax:
MATLAB if-else... end statement if expression
Statements
If the first condition is not true, then we can if expression
define other statements to run by Statements
usingthe else keyword. else
Statements
Syntax: end
if expression elseif expression
Statements Statements
else if expression
Statements Statements
end end
else
Statements
end
MATLAB Loops
A loop statement allow us to execute a statement or group of statements multiple times.
MATLAB provides different types of loops to handle looping requirements, including while loops, for
loops, and nested loops. If we are trying to declare or write our own loops, we need to make sure that
the loops are written as scripts and not directly in the Command Window.
Two additional command, break and continue, can be used to create a third type of loop, known
as midpoint break loop. Midpoint break loop is useful for situations where the commands in the loop
must be executed at least once, but where the decision to exit the loop is based on some criterion.
Types of Loops
There are two types of loop in MATLAB
1.for
2.while
Syntax
Syntax
for index = values
while <expression>
<program statements>
<statements>
...
end
end
Week 6- Case Studies and Final Project