MATLAB?? - PowerPoint PPT Presentation

1 / 73
About This Presentation
Title:

MATLAB??

Description:

Title: MATLAB Author: Last modified by: yuan Created Date: 3/6/1998 2:28:18 PM Document presentation format: – PowerPoint PPT presentation

Number of Views:99
Avg rating:3.0/5.0
Slides: 74
Provided by: 498856
Category:
Tags: matlab | scilab

less

Transcript and Presenter's Notes

Title: MATLAB??


1
Matlab????
2
1 ??????
  • MATLAB??
  • ??matlab?????
  • ????
  • ????
  • ??????Simulink??
  • ??????????c????????
  • ?????

3
2 Matlab?????
  • ????????,???????
  • ??????????,?????
  • ??????,????????
  • ????,???????
  • ??Matlab???????

4
??Matlab???????
  • ?????????????????????

5
OK, Now begin
6
MATLAB ??????
??????????????????? baowen_at_turbo.hit.edu.cn
  • ??? MATLAB??
  • ??
  • MATLAB????
  • MATLAB???????
  • ????
  • ????

gt
gt
gt
gt
gt
7
????
  • MATLAB????????????????????,???????????????????????
    ???????,?????????

8
1.1 MATLAB???
  • 70????,Cleve Moler????????LINPACK?EISPACK?Fortran
    ????
  • 70????,Cleve Moler ???????????????,??????????,???
    ???MATLAB,?MATrix LABoratory
  • 1983???,???John Little?Moler?Steve
    Bangert???????????MATLAB
  • 1984?,MathWorks????,MATLAB???????

9
1.2 ??Matlab?????
  • ??????????????,??????????
  • ????????????????????????
  • ?????????????????????????????
  • ??????????????
  • ?????????
  • From BBS????Matlabword

10
1.3 Matlab?????
  • Matlab 1.0
  • Pc matlab-gtmatlab 386
  • Matlab3.5simulink
  • Matlab 4.0simlink??
  • Matlab 5.0 ???????
  • Matlab 5.15.3
  • Matlab 6.0
  • Matlab 6.5???MATRIXx
  • Matlab 7.02004

11
1.4 MATLAB??
  • ?????????MATLAB??????????,?????????MATLAB???
  • ???? MATLAB??????ASCII??,?????????
  • ???????????????windows/unix/dos/Macintosh
  • ???????

12
1.5 Matlab????
  • ???????
  • ??????
  • ??????????????
  • ????Excel?????A/D??
  • ??????Pc/104?DSP
  • ???????????GA??
  • ??????

13
Matlab????
  • Matlab?????matlab???????????
  • ?????????,??????????
  • Simulink???????
  • Blockset????simulink??????

14
Matlab??????????
15
???????
16
??????
17
???????
18
?????????
19
1.6 ????
  • USENET???
  • MATLAB?????comp.soft-sys.MATLAB??????
  • http//www.dejanews.com
  • http//www.google.com
  • ???????
  • http//www.mathtools.com/
  • http//www.mathworks.com/matlabcentral/fileexchang
    e/loadCategory.do

20
1.7 ?MATLAB?????
  • Mathmatica ?????????????,??????
  • Mathcad ?????????????
  • Maple ????????
  • SciLab ???matlab???
  • ????MATRIXx?VisSim??

21
??MATLAB????
  • 2.1 MATLAB????
  • Matlab???
  • ????
  • ??Java???XP?????????
  • ??pdf??
  • Matlab??
  • ????? startup.m matlabrc.m

22
2.2 Matlab?????
  • ?????
  • Matlab???
  • ????
  • ????
  • ??????
  • ?????

23
2.3?????
  • help ???????????
  • lookfor??????????
  • Matlab Help????,??,???
  • Demo
  • ???????

24
2.3.1 ???????????
  • ???MATLAB????help??,???????,??????????????????????
    ??Help??????,????????????,??????,?????????????????
    ?
  • Help Desk??MATLAB?HTML???????,????????????????hel
    pdesk,??Matlab Help Desk?Help
    Desk?????????????,?????????????????????
  • ??????????????????????,???????????,????????????MAT
    LAB????????MATLAB??????????????????????,???PDF??,?
    ?????,?????????????????,???????

25
2.4 Matlab??
  • ????
  • ??
  • ????????
  • ????????????
  • ????
  • ??????????
  • ??????19???,?19??????????
  • ?????????,?????????????????
  • ????????????

26
2.4.1 ????
27
2.4.2 ??
  • ????????????????a10-9i
  • ???????????,??????

28
2.4.3 ????
  • MATLAB????????????,?????????
  • ??????,??????,????????????,????4?????????
  • ?????????????????,???????????
  • format????????,???????
  • long (16?) bank(2?????) hex(????)
  • short(??) short e(5????) (??)
  • long e(16????) rat(?????)

29
2.5 ??????
  • who(whos)
  • cd(chdir,pwd)
  • dir(ls)
  • type
  • what
  • which
  • clc
  • edit
  • !
  • echo
  • load
  • clear/pack
  • save
  • diary

30
??MATLAB???????
  • 3.1 ??????
  • ?????????
  • ????????
  • ?????, NaN Inf
  • ??????
  • ??????????
  • ???????
  • load??
  • ?????????,?????
  • mat??matlab???????

31
2??????
  • ?????????,??fromstepto
  • linspace??
  • alinspace(1,10,5)
  • logspace??
  • blogspace(0,2,10)
  • ????
  • ca b
  • zeros ones eye randn

32
3. ?????????
  • ????import wizard
  • ?????????
  • ???? .txt .dat
  • ???? .gif .bmp .jpg .avi
  • ??.wav .au
  • ????.csv .xls .wk1

33
??????????????
34
??????????????
35
3.2 ????
  • ?????
  • ?????????
  • ????? .
  • ???????
  • -/ \
  • ??. ??./ ??.\
  • ?????
  • ????
  • .????????
  • ?????
  • norm 1-?? 2-?? ????
  • ??? cond

36
3.3 ???????
??? ??
abs ????????
sqrt ???
real ??
imag ??
conj ????
round 4?5????
fix ??????0???
floor ??????-8???
ceil ??????8???
  • MATLAB?exp?sprt?sin?cos?????????????,?????????????
    ????,????????????????MATLAB?????????????
  • ???????

37
3.3 ???????
??? ??
sinh ????
cosh ????
tanh ????
exp ????
log ????
log10 ?10?????
bessel ?????
gamma ????
rat ????
??? ??
sign ????
rem ??
sin ??
cos ??
tan ??
asin ???
acos ???
atan ???
atan2 ???????
38
3.4 ???????
  • 1 ?????
  • MATLAB?????????lt(??)?lt(?????)?gt(??)?gt(?????)?
    (??)? !(???)?
  • MATLAB?????????????????????,?????????????????????,
    ??????????
  • a19
  • bagt4
  • b
  • 0 0 0 0 1 1 1 1
    1
  • ca(agt4)
  • c
  • 5 6 7 8 9

39
2 ?????
  • ????????????????????MATLAB???????(?)?(?)?(?)???
  • c(agt4)
  • c
  • 1 1 1 1 0 0 0 0
    0
  • c(agt4)(alt7)
  • c
  • 0 0 0 0 1 1 0 0
    0

40
??????
  • 4.1 ????
  • MATLAB??????,?????????????????????????
  • ??????a??n???m?????,??a(n,m)???????,???a??n???m???
    ????r,??a(n,m)r????????????,?????????,???????????
    ?,??????????,?????????????,?MATLAB?????????,?????
    ?,?????????

41
4.1 ????
  • ??????,MATLAB????????????????a(n,m),??n?m???,?????
    ,???????????.
  • ??,???????????????????,n?m?,????????????
  • ?????????????(???),?????????????.
  • ????????????

42
4.2????
  • ?MATLAB????,??whos???????????????
  • ?????????????,MATLAB???????????size?length?
  • size?????????m,nsize(a,x)????,???????x???,????
    ????????,size???????,???????,????????????????,???
    ??????,?????????????x?,x1????,x2????,??????????
  • length????????????,?length(a)max(size(a))?

43
4.3 ??????
  • MATLAB??????????????,??flipud(a)????????,fliplr(a)
    ????????,rot90(a)?????????900???

44
4.4????
  • ??????????????,????0??1???????????????????????????
    ??????????,
  • ?????????3?????????????????????

45
4.5 ???????
  • ????????find????,????????????????
  • a1020
  • find(agt15)
  • ans
  • 7 8 9 10 11
  • ???????sort??,???????????

46
5????????
  • ????????find????,??????????????
  • ???????sort??,???????????
  • ??
  • ????a(find(altstd(a)3))
  • ?????????????????
  • ????????????

47
6 ?????
  • MATLAB ?????????????????????,????????,????????????
    ??MATLAB ?,???????????????????
  • ??????????????????????
  • ??????????????????

48
?????
  • eval(string) ????MATLAB ????????
  • eval(try,catch)
  • blanks(n) ????n ?????????
  • deblank ???????????
  • feval ???????????
  • findstr ????????????
  • isletter ?????????
  • isspace ???????????
  • isstr ????????,????
  • lasterr ????????MATLAB ??????
  • strcmp ?????,????
  • strrep ??????????????
  • strtok ??????????????

49
????
  • char x77 65 84 76 65 66 char(x)
  • int2str ?????????????
  • num2str ?????????
  • mat2str ????????????
  • str2num

50
7 ????
  • ????cell
  • ???????????????
  • ???????????????,???????????,???????????
  • ppcellstr('asd' 'testetet' 'sfsdfsdfdfgsdgsg'
    'sfdfgfdfgf')
  • ????pp(1)?pp1???
  • ????????pp(3) ?pp3???

51
8 ???
  • ??????????????????????????
  • ????????a.b1
  • ??????????pp(m,n)struct(a)
  • ??????pprmfield(pp,b)

52
????
  • ??????,????????????????????????,???????????MATLAB
    ?????????,??????????????????????,???MATLAB???????,
    ??????????,???????m????,????M?????????????,???????
    ????
  • ??????,???????????,?????????????????????????????
    ????????????????

53
4.1 ????
  • ??????,MATLAB?????????????????????????????,???????
    ?,??????????????,??????????
  • 1 for??
  • for????????????????,???????
  • for xarray
  • command
  • end
  • for ?end?????????array????????,??n?????

54
For???????????
  1. for???????????????????
  2. for???????????MATLAB??
  3. for??????
  4. ??????????????,????for?????for?????????,????MATLAB
    ????????????Tic/toc
  5. ??????break??,?????????,??????????

55
2while??
  • ?for???????????????,while????????????????While????
    ????
  • while expression
  • commonds
  • end
  • ?????expression????????,??????commands????????????
    ??,??????????

56
3 if-else-enf??
  • ?????,????????????????????,??if-else-end??????????
    ?
  • if expression1
  • commands1
  • elseif expression2
  • commands2
  • elseif
  • else
  • commands
  • end

57
If- Then- Else
  • ??????,MATLAB?????????,???????????????,???????????
    ?,?????if-else-end??,??,???else???????

58
try-catch??
  • ?????????,????????
  • try
  • ???????
  • catch
  • ????
  • end

59
4.2 ??
  • ????????????????????,??????????????,?????????
  • 1 ????
  • ??????????
  • out1,out2,function(in1,in2,)
  • ????????,??????????,??????(???????)?
  • ????,?????????????

60
??
  • ?????????????,??????????????????????????????,????
    ?????,??????????,??MATLAB????????????
  • ?????????????MATLAB?????????,?????????????????,???
    ????????m??????,??????,??????????
  • ?????????????,???help?????????????

61
2 ????
  • MATLAB??????????????,??????,??????????????????????
    ????????nargin?nargout?????????????????????????,??
    ?????
  • ?MATLAB?,?????????????????????????????????,???????
    ???????????????????????,????????????????
  • ??global?????????????,?????????????????????????,??
    ???????????

62
3 ????
  • ?????????M ??????????????????,????????M
    ????????????????????????????????M ???function
    ???????????,?????????????
  • ????????,??????????????,??????????????????nargin
    ????????????????nargout ????????????,????????????
    ???,???????????????M ?????,??nargout
    ????????????,??????????????

63
3 ????
  • ??????????????,??MATLAB ??????????????MATLAB
    ??????????????????????????????????????,??????????,
    ???MATLAB ????????????????????????????,???????????
    ???,????????,???????????,???????????????????

64
3 ????
  • ????????,????????????????,???????????????,????????
    ???,?????????????????,???,?????????????,??,??xfun
    (x, y, z) ??x ,??????????????????,???????????,????
    ????????,????????,???????????????????

65
3 ????
  • ??????????,??????????MATLAB ??????????????????????
    ?MATLAB ???????????,????????????,???????????
  • ?????,??????????????????????????,?????????,???????
    ???,???????????M ??????????????,??????????????????
    ??

66
3 ????
  • MATLAB ????????????????M ?????,?? cow ,MATLAB
    ????cow ???????????,??MATLAB ????????????????,MATL
    AB ????cow.m ??????????????,MATLAB ???cow.m
    ?MATLAB ???????????????
  • ???M ??????????????????,????????????,???MATLAB
    ????????M ??????????????????????????????,?????????
    ???,???M ??????????????????

67
3 ????
  • ?MATLAB ???,???????Toolbox ????Toolbox
    ?????????????M ???????????MATLAB ??????????M
    ???????M ???????????????????,???????,MATLAB
    ??????????????,??????M ?????,?MATLAB ???,??M
    ?????Toolbox ???,????????????,?????????,?M
    ????????,????????Toolbox ???,???????MATLAB
    ???,???????????????????,???????????Toolbox
    ??????????????,???MATLAB ??????,?????????

68
3 ????
  • MATLAB ??error ????????????,??????,???????????????
    ???????????,?????????
  • if length(val)gt1
  • error(' VAL must be a scalar. ')
  • end
  • ??,????val ??????,error ???????,???????????????

69
??
  • echo
  • input xinput( )
  • keyboard return
  • pause
  • debug matlab edit
  • tic /toc

70
??????
  • sparse ???????????
  • speye
  • sprand(n,m,d)/sparandn
  • full
  • spy
  • gplot

71
????????????
72
??????????
73
???
  • ??????,?????for?while??????????
  • 1
  • 2.??yxsin(x) ?0ltxlt100?????
Write a Comment
User Comments (0)
About PowerShow.com