Anda di halaman 1dari 17

Introduction To

MATLAB
S.S.R.K.M.GUPTA.M.Tech.,(M.Phil)
Assistant Professor

Introduction
MATLAB Stands for MATrix LABoratory
Initially developed by a lecturer Cleve Moler, at the

University of New Mexico in 1970s to help students learn


linear algebra.
It was later marketed and further developed under MathWorks Inc.
(founded in 1984) www.mathworks.com
Matlab is a software package which can be used to perform
analysis and solve mathematical and engineering problems.
It has excellent programming features and graphics capability
easy to learn and flexible.
Available in many operating systems Windows, Macintosh, Unix,
DOS
It has several tooboxes to solve specific problems.

MATLAB Functionality
Built-in Functionality includes
Matrix manipulation and linear algebra
Data analysis
Exploration and visualisation
Algorithm development
Modelling, simulation, and prototyping
Scientific and engineering graphics
Add-on toolboxes provide
Image

processing
Signal Processing
Optimization
Genetic Algorithms
and hundreds of other functions

MATLAB consists of
The MATLAB language
The MATLAB working environment
Handle Graphics
The MATLAB function library.
The MATLAB Application Program Interface

(API)

Some features of MATLAB

Everything in MATLAB is a matrix !


MATLAB is an interpreted language, no compilation
needed (but possible)
MATLAB does not need any variable declarations,
no dimension statements, has no packaging, no
storage allocation, no pointers
Programs can be run step by step, with full access
to all variables, functions etc.

What kind of graphics is possible in Matlab?


1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-3

-2

-1

x = -2.9:0.2:2.9;
bar(x,exp(-x.*x));
6

What kind of graphics is possible in Matlab?


1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

0.5

1.5

2.5

3.5

4.5

Line plot:
x=0:0.05:5;y=sin(x.^2);plot(x,y);
7

What kind of graphics is possible in Matlab?


0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
-0.05
-0.1
-0.15

0.5

1.5

2.5

3.5

Stem plot:
x = 0:0.1:4;, y =
sin(x.^2).*exp(-x); stem(x,y)
8

What kind of graphics is possible in Matlab?

10
5
0
-5
-10
30
20
10
0

10

15

20

25

Mesh plot: z=peaks(25); mesh(z);


9

What kind of graphics is possible in Matlab?


10
5
0
-5
-10
30
20
10
0

10

15

20

25

Surface plot:
z=peaks(25);, surf(z);, colormap(jet);

10

What kind of graphics is possible in Matlab?


25

20

15

10

10

15

20

25

Contour plot: z=peaks(25);


contour(z,16);

11

What kind of graphics is possible in Matlab?

12

MATLAB variables
Matlab treats all variables as matrices. For our

purposes a matrix can be thought of as an


array, in fact, that is how it is stored.
Vectors are special forms of matrices and
contain only one row OR one column.
Scalars are matrices with only one row AND
one column

Identifiers in Matlab
Have not to be previously declared
Variable names can contain up to 63

characters
Variable names must start with a letter
followed by letters, digits, and underscores.
Variable names are case sensitive

Matlab Special
Variables
ans
Default variable name for results
pi
Value of
eps
Smallest incremental number
inf
Infinity
NaN Not a number e.g. 0/0
realmin
The smallest usable positive real

number
realmax
number

The largest usable positive real

Data Types

Anda mungkin juga menyukai