Title: MATLAB ??????
1MATLAB ??????
- ???
- hyfan_at_ntnu.edu.tw
- http//math.ntnu.edu.tw/hyfan
- ?????????
22.1 ?????
32.2 MATLAB ??????
var expression
4????(I)
5????(II)
6??????
?? ??
zeros(m, n) ????? mn ,?????? 0 ???
ones(m, n) ????? mn ,?????? 1 ???
eye(n) ????? nn ,????????? 1 ,??????? 0 ?????
pascal(m, n) ????? mn ? Pascal ??
vander(m, n) ????? mn ? Vandermonde ??
hilb(n) ????? nn ? Hilbert ??
rand(m, n) ?? 0, 1 ?????????,???? mn
randn(m, n) ?? µ 0, s 1 ?????????,???? mn
magic(n) ????? nn ????,????????????????????
7??????????
30
82.3 ????????
- ? MATLAB ??????,?????????,????????,????(Dimensions
)?? 1 ??????????????(Multidimesional Arrays,??
N-D Arrays)?
9????(I)
- ?????????,??????(Dimensions)
- ????(Row)
- ????(Column)
??
(1,1) (1,2) (1,3) (1,4)
(2,1) (2,2) (2,3) (2,4)
(3,1) (3,2) (3,3) (3,4)
??
10????(II)
- ????,?????? X - Y ??????,????
Y(?)
X(?)
11???????? (I)
12???????? (II)
4 1 10 6 1 11 6 16 2 21
8 2 2 7 9 12 4 17 7 22
7 3 5 8 7 13 1 18 5 23
0 4 3 9 4 14 5 19 4 24
23 5 13 10 13 15 0 20 3 25
A
13????(I)
- ???????????,????????,???????????(Page),????
(1,1) (1,2) (1,3) (1,4)
(2,1) (2,2) (2,3) (2,4)
(3,4)
?
(1,1) (1,2) (1,3) (1,4)
(2,1) (2,2) (2,3) (2,4)
(3,1) (3,2) (3,3) (3,4)
?
?
?
14????(II)
- ????,?????? X - Y - Z ??????,????
Z(?)
Y(?)
X(?)
15????(III)
- ??????,??(?,?,?)???
- ???? 342 ???????,??????????
- ?? A ?????,?? A(,,1)??????????,A(,,2)?????????
??
162.5 ?????
?? ? ?
pi ?? ?15???????
i, j ?? ??
inf ?????,?????0???
NaN ????,????????????
eps ?????????????
ans ????????????
172.6 ??????
???? ? ? ? ?
format short ??4???(???) 12.3457
format long ??14??? 12.345678901234567
format short e ??5??????? 1.2346e001
format short g ????5???(????????) 12.346
format long e ??15???????? 1.234567890123457e001
format long g ????15???(????????) 12.3456789012346
format hex 16?????? 4028b0fcd32f707a
18disp
19fprintf???? ?
20Example/conv_rate/conv_ratio.m
???? ? ?
d ?????????
e ?????????
f ??????????
g ?????????????,??????????
\n ??????
212.7 ????
222.8 ???????
???? MATLAB ??
?? a b
?? a - b
?? a b
?? a / b
??? ab
23???????
- ?????????????,MATLAB ??????????????
24????????
- ???????,??????????????( Column Dimension)
??????????????(Row Dimension)
25????????
- A\b????? inv(A)b ???,??inv(A)?A????
26???????
- ???????,???????,????????,?????????
- ???,?/????????????,MATLAB ??????????????(Element
-by-element) ???
27???????????
- ???? z,?????????(Conjugate Transpose) ?????? z'
- ??????? z ???(Transpose),??????? z. '
- ? z ???,? z' ? z.' ???????
282.11 ??????
- x 00.110
- y x.210.x15
- plot(x,y)
29???????(I)
option ????
-deps ??????? eps ??
-depsc ??????? eps ??
-dpng ???? png ??
-dtiff ??????? tiff ??
30???????(II)
31??????
- x 0pi/1002pi
- y1 sin(2x)
- y2 2cos(2x)
- plot( x, y1, x, y2 )
32?????????????????(I)
33?????????????????(II)