Escolar Documentos
Profissional Documentos
Cultura Documentos
Gemechu Fanta
1 / 26
Gemechu Fanta
Introduction
outline
Introduction
First Step In Matlab
I
I
Getting Started
The Matlab Environment
A) Scalar Operation
B) Vector/Matrix Operation
C) Command Window Navigation
Gemechu Fanta
Introduction
Introduction
3 / 26
Gemechu Fanta
Introduction
Introduction...
The MATLAB environment consists of families of application
specific packages that integrate with MATLAB system, various
sepcialized m-files designed to deal with particular/specific
problems.
4 / 26
Gemechu Fanta
Introduction
Introduction...
The MATLAB environment consists of families of application
specific packages that integrate with MATLAB system, various
sepcialized m-files designed to deal with particular/specific
problems.
MATLAB is interactive software whose basic data element is an
array. An array does not require diemnsioning.
4 / 26
Gemechu Fanta
Introduction
Introduction...
The MATLAB environment consists of families of application
specific packages that integrate with MATLAB system, various
sepcialized m-files designed to deal with particular/specific
problems.
MATLAB is interactive software whose basic data element is an
array. An array does not require diemnsioning.
Such an application-specific package is called a toolbox.
4 / 26
Gemechu Fanta
Introduction
Introduction...
The MATLAB environment consists of families of application
specific packages that integrate with MATLAB system, various
sepcialized m-files designed to deal with particular/specific
problems.
MATLAB is interactive software whose basic data element is an
array. An array does not require diemnsioning.
Such an application-specific package is called a toolbox.
They are used for control theory, optimization, partial differential
equations, signal processing, symbolic computation, simulation
etc.
4 / 26
Gemechu Fanta
Introduction
Introduction...
The MATLAB environment consists of families of application
specific packages that integrate with MATLAB system, various
sepcialized m-files designed to deal with particular/specific
problems.
MATLAB is interactive software whose basic data element is an
array. An array does not require diemnsioning.
Such an application-specific package is called a toolbox.
They are used for control theory, optimization, partial differential
equations, signal processing, symbolic computation, simulation
etc.
MATLAB is a case sensitive programming language that has
sophisticated data structures, built-in editing and debugging
tools.
4 / 26
Gemechu Fanta
Introduction
Gemechu Fanta
Introduction
First...
or go to the start menu,
put your cursor on all
programs then follow
the links as shown in the
right.
to get the icon
,
finally double click it. In
either case, within a few
seconds MATLAB will
be evoked and you will
see a screen like the
following, the MATLAB
desktop.
6 / 26
Gemechu Fanta
Introduction
First...
or go to the start menu,
put your cursor on all
programs then follow
the links as shown in the
right.
to get the icon
,
finally double click it. In
either case, within a few
seconds MATLAB will
be evoked and you will
see a screen like the
following, the MATLAB
desktop.
6 / 26
Gemechu Fanta
Introduction
First...
This is the MATLAB
desktop/screen, composed of
three parts (as you see), The
Command window,
Workspace window and the
Command history window.
The MATLAB environment is
command oriented somewhat
like UNIX.
A prompt appears on the screen
and a MATLAB statement can
be entered.
7 / 26
Gemechu Fanta
Introduction
First...
This is the MATLAB
desktop/screen, composed of
three parts (as you see), The
Command window,
Workspace window and the
Command history window.
The MATLAB environment is
command oriented somewhat
like UNIX.
A prompt appears on the screen
and a MATLAB statement can
be entered.
7 / 26
Gemechu Fanta
Introduction
First...
When the < ENTER >key is pressed, the statement is executed,
and another prompt appears.
To close MATLAB go to File menu and then choose Exit
MATLAB or tye one of the commands quit or exit at the
MATLAB prompt and then hit return, i.e.
>> exit or >> quit or press keys ctrl-Q.
1.2. The MATLAB Environment
Basically, the MATLAB desktop environment has the following
window components
Command Window
Command History Window
Current Directory Window
MATLAB Path Window
Launch Pad Window
8 / 26
Workspace WindowGemechu Fanta Introduction to Computing with MATLAB
Introduction
9 / 26
Gemechu Fanta
Introduction
First...
Command window, also
called MATLAB prompt
window, is the primary place
where you interact with
MATLAB. It is where you type
commands directly to the
MATLAB for execution.
The symbol >>, called
MATLAB prompt is displayed in
this window and afterwards a
cursor appears. A blinking
cursor signifies that MATLAB is
ready to accept and execute a
command.
10 / 26
Gemechu Fanta
Introduction
First...
Command History Window
is a window that displays all
commands issued in MATLAB
since the recent past session,
i.e. all previous commands
executed in a MATLAB session.
It is useful for verification of a
computational sequence.
One can navigate through
command window from the
keyboard, using up-arrow,
down-arrow, left-arrow and
right-arrow. Up-arrow is used
to repeat previous commands.
11 / 26
Gemechu Fanta
Introduction
First...
12 / 26
Gemechu Fanta
Introduction
First...
13 / 26
Gemechu Fanta
Introduction
Integer
Real
Complex
Introduction
The default format is four digits after the decimal point. But if you
want to change it use
<< format long e
<< format short e
>> 1/3
>> 1/3
ans =
ans =
3.333333333333333e-001
3.3333e-001
>> 1.57
>> 1.57
ans =
ans =
1.570000000000000e+000
1.5700e+000
>> 4
>> 4
ans =
ans =
4
4
15 / 26
Gemechu Fanta
Introduction
MATLAB Command
format short
format long
format short e
format long e
format short g
long g
+
bank
rat
16 / 26
Description
4 digits after the decimal point
14 digits after the decimal
5 digits and an exponent
Floating point format
with 15 digits.
Best of fixed or floating point
format with 5 digits
Best of fixed or floating point
format with 15 digits
The symbols +, - and blank are printed for
postitive, negative, and zero elements.
Imaginary parts are ignored.
Fixed formats for dollar and cents
Approximation by ratio of small integers
Gemechu Fanta
Introduction
Gemechu Fanta
Introduction
If you want to know all active/current variables you are working with,
just type the command who after the MATLAB prompt and press
return, you will get a list of currently active variables as under,
The value of a variable can be a scalar, any number or a
vector/matrix,
>> x = 91
x=
91
>> y = [2 1 3]
y=
23
>> z = [2 1 3;0 1 2]
z=
213
012
18 / 26
Gemechu Fanta
Introduction
19 / 26
Gemechu Fanta
Introduction
19 / 26
Gemechu Fanta
Introduction
A) Scalar Operation
20 / 26
Gemechu Fanta
Introduction
B) Vector/Matrix Operation
21 / 26
Gemechu Fanta
Introduction
22 / 26
Gemechu Fanta
Introduction
22 / 26
Gemechu Fanta
Introduction
Gemechu Fanta
Introduction
24 / 26
Gemechu Fanta
Introduction
Thank You!
25 / 26
Gemechu Fanta
Introduction
26 / 26
Gemechu Fanta
Introduction
26 / 26
Gemechu Fanta