Professional Documents
Culture Documents
Matlab Lecture 1
Matlab Lecture 1
. .
Ver. 1.1
9/2012
MATLAB
(scientific computing).
MATtrix LABoratory ( )
. . 1
MATLAB
(interactive)
(data visualization)
. . 1
MATLAB
(command interpreter),
(MATLAB command
window). :
MATLAB
(toolboxes)
(functions) MATLAB
(scripts)
m-file
. . 1
MATLAB
:
. . 1
(
) MATLAB
.
.
MATLAB help
. . 1
:
(Command
Window) . MATLAB
(prompt) >>.
().
. . 1
(Current Directory)
.
, Current Directory.
Workspace Current Directory
(workspace).
, Workspace.
. . 1
(Command History).
Command History View.
.
. . 1
10
MATLAB
(document windows),
(graphics windows)
(editing
windows).
. . 1
MATLAB
:
quit exit
,
[x]
MATLAB,
File Exit MATLAB
.
11
. . 1
MATLAB
12
version
MATLAB
ver
,
(operating system),
(compiler)
(toolboxes)
. . 1
13
. . 1
FORTRAN C,
MATLAB
:
.
.
.
,
.
14
. . 1
. MATLAB
.
y Y .
:
( ).
,
(underscore).
MATLAB (.. ).
.
15
. . 1
16
MATLAB
.
; (semicolon).
,
. . 1
To Matlab 5
.
: format Compact
E (scientific notation).
0.0001234 4567.89
short e long e
1.234e-4 4.56789e3
17
. . 1
:
>>pi
ans = 3.1416
>> format long
>> pi
ans = 3.141592653589793
: format
18
. . 1
format rat
() :
>> format rat
>> a=cos(pi/4)
a=985/1393
19
. . 1
MATLAB
.
: a+bi
a b
i
:
20
. . 1
>>z1=3+4i
z1 = 3.0000 + 4.0000i
>> z2=conj(z1)
z2 = 3.0000 - 4.0000i
21
. . 1
-
MATLAB
:
22
[
r.. ]. 11 , .
(!), .
.
(;)
MATLAB
. . 1
23
MATLAB
.
MATLAB .
true () MATLAB 1
false () 0. true,
logical(1) logical(true) 1,
false, logical(0) logical(false)
0
. . 1
24
. . 1
25
. . 1
26
:
MATLAB
(
a
).
,
MATLAB .
. . 1
27
; ,
.
MATLAB
.
([]
[])
.
[].
. . 1
28
. . 1
29
. . 1
Format
30
. . 1
31
. . 1
-
MATLAB:
1. ()1000/11, () 12345 6789, () (1.13 + 17.24)/24
2. x , y = x/105 z =
125 :
(x + y)/100, , (x + y)/z, xyz.
3 z = 1 3i, u = 2 + 5i
w = 4 + i. :
z + w, zwu, z/(u + w), z
(z w).
32
. . 1
-
H (F)
(C) :
9
F = C + 32
5
33
Command Window
(i) 100
(ii) C,
75
. . 1
-
Command Window :
(i) 0 100,
(ii) 1 10,
(iii) 1 30.
34
. . 1
35
. . 1