0% found this document useful (0 votes)
56 views

LAB MAR Introduction of MATLAB - 2

This document discusses an introduction to MATLAB and robotics. It covers several MATLAB topics including [1] matrices and arrays, [2] arithmetic and logical operators, and [3] flow control using for, while, and if/else statements. It also discusses [4] using M-files and [5] importing data from Excel. Finally, it provides introductory definitions and concepts related to robots and robotics.

Uploaded by

Adil Rasheed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

LAB MAR Introduction of MATLAB - 2

This document discusses an introduction to MATLAB and robotics. It covers several MATLAB topics including [1] matrices and arrays, [2] arithmetic and logical operators, and [3] flow control using for, while, and if/else statements. It also discusses [4] using M-files and [5] importing data from Excel. Finally, it provides introductory definitions and concepts related to robots and robotics.

Uploaded by

Adil Rasheed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

BITS Pilani

Pilani | Dubai | Goa | Hyderabad

Introduction to MATLAB (PART-2)


Ag e n da

1. Matrices and Arrays

2. Operators (Arithmetic, relational, logical )

3. Flow Control

4. Using of M-File

5. Introduction to robot and robotics


He l p Bro ws e r
There are several ways to get help in MATLAB.
o helpdesk
o helpwin
o help function
o lookfor keyword
o doc Keyword
M- L in t Co de C h ec k R e p o rt
MATLAB provides tools to help you manage and improve your M-files, including
the M-Lint Code Check reports. You run a report for all files in the current directory.
Alternatively, you can use the mlint function to get results for a single M-file. (1)
1 . A rr a y s a nd Mat r ic e s

An array is a collection of values that are represented by a single variable


name. One dimensional arrays are called vectors and two-dimensional arrays are
called matrices.
Entering Matrices
o Separate the elements of a row with blanks or commas.
o Use a semicolon “ ; ” to indicate the end of each row.
o Surround the entire list of elements with square brackets [ ].
Ty p e s o f A rr a ys
Ma t ri c es Op e ra t io n s
• sum
• transpose
• Diagonal
• Magic
• Swap columns/rows
• Delete columns/rows
• Concatenating
• Ones
• Zeros
• Size
• Inverse
• Determinant
• Eigenvalues and eigenvectors
• Random numbers (4)
T h e C o l on Op e r at o r

(5)
2 . Op e ra t or s (A ri th m et i c)

BODMAS (6)
E l em e n t b y e l e m en t Op e ra t o rs

7
Ma t la b R e l at i on a l Op e ra to r s

MATLAB supports six relational operators

o Less Than <


o Less Than or Equal <=
o Greater Than >
o Greater Than or Equal >=
o Equal To ==
o Not Equal To ~=
Ma t la b L o g ic a l Op er a t or s

MATLAB supports three logical operators.

 not ~ % highest precedence


 and & % equal precedence with or
 or | % equal precedence with and
3 . F l o w C o nt r ol

For loop Syntax


for index = values
Statements
end
Example:
0 1 1 2 3 5 ………..
a +b = c
a + b = c

(8)
F l ow Con t ro l

While loop Syntax

While expression
Statements
End

Example:
3!=3x2!
4!=4x3!
5!=5x4!
F l ow Con t ro l

if, else if, else loop Syntax

if expression
Statements

elseif expression

statements
else
Statements
end (8)
4 . Us in g of M- F il e

Click to create
a new M-File

• Extension “.m”
• A text file containing script or function or program to run
I m p or t in g d a t a
Importing excel sheet into the MATLAB and we can perform all mathematical
manipulations like
• Mean
• Mode
• Median
• Standard deviation
• Variance
• Range
• Min value
• Max value
I n tr o du c t io n t o Ro b o ts a nd Ro b o ti c s

Definitions

• The term: robot has come from the Czech word: robota, which means forced or
slave labourer

• In 1921, Karel Capek, a Czech playwright, used the term: robot first in his drama
named Rossum’s Universal Robots (R.U.R)

• According to Karel Capek, a robot is a machine look-wise similar to a human


being
I n tr o du c t io n ( C o n td ., )
Robot has been defined in various ways:
1) According to Oxford English Dictionary A machine capable of carrying out a
complex series of actions automatically, especially one programmable by a
computer
2) According to International Organization for Standardization (ISO): An
automatically controlled, reprogrammable, multipurpose manipulator
programmable in three or more axes, which can be either fixed in place or
mobile for use in industrial automation applications
3) According to Robot Institute of America (RIA) It is a reprogrammable multi-
functional manipulator designed to move materials, parts, tools or specialized
devices through variable programmed motions for the performance of a variety
of tasks
Note: A CNC machine is not a robot
THANK YOU

You might also like