1 / 31

Matlab

????. ????????????????????????plot???????????????????????. ??. MATLAB?Matrix Laboratory(?????)???,?Mathematica?Maple?????????? 20??70??,????????????????Cleve Moler?FORTRAN??????MATLAB?1984??Little?Moler?Steve Bangert??????MathWorks?????MATLAB?????. MATLAB??. . ????. >> (1 2*5-4)/2ans = 3.50000000000000??????:?( ),?(-),?(*),?(/),??(^)>> 2^10ans = 1024.

Thomas
Download Presentation

Matlab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Matlab ?????? ?? ????

    2. ???? ???? ????? ???? ???? ??????? plot ???? ??????? ????? ???????

    3. ?? MATLAB?Matrix Laboratory(?????)???,?Mathematica?Maple?????????? 20??70??,????????????????Cleve Moler?FORTRAN??????MATLAB? 1984??Little?Moler?Steve Bangert??????MathWorks?????MATLAB?????

    4. MATLAB??

    5. ???? >> (1+2*5-4)/2 ans = 3.50000000000000 ??????:?(+),?(-),?(*),?(/),??(^) >> 2^10 ans = 1024

    6. ???? ????,Matlab??????????ans ??????????????,?y >> y=(1+2*5-4)/2 y = 3.50000000000000 ???????? ??:Matlab?????????double??,??????

    7. Matlab???? eps:?????? exp:???????e i ? j:?????? inf:???, ??1/0 NaN:???(Not a number),??0/0 pi:??? p(= 3.1415926...) realmax:??????????? realmin:???????????

    8. ?? ???????: 1. ?????,?:M?m?? 2. ??????????,????????????? 3. ????????31?(matlab7) 4. ??????????,?i,j (???)

    9.

    10. ?????? ????????format????? ??:format???????,????????? Matlab??????????? format short ??? format long ??? format short e ???e?? format long e ???e?? format bank 2?????? ?:??file>preferences>command window??

    11. ?matlab????????????????????????mat????? 1. save 覧 ?????????????matlab.mat???? 2. save data覧?????????????data.mat???? 3. save data a b 覧??????a?b????data.mat???? ????matlab????load????????mat??? ????????

    12. ?load 覧 ?load data 覧 ?load data a b 覧 mat???????????,???ASCII??????

    13. ???? sin,cos,tan,cot,sec,csc,asin,acos,atan,acot,asec,acsc,sinh,cosh,tanh sqrt (?????),exp (e???),pow2(2???),log(????,?e??),log10,log2,abs(????????) real(???),imag(???),angle(???),sign(????) round(??????),floor(?-inf??),ceil(?+inf??) ,fix(?0??) ???????????????,??????(??)?,???????????????

    14. ????? ???????? ????????????????,matlab????????????? ???????????,??????????

    15. ??,?????? sin,cos,tan,cot,sec,csc,asin,acos,atan,acot,asec,acsc,sinh,cosh,tanh sqrt (?????),exp (e???),pow2(2???),log(????,?e??),log10,log2,abs(????????) real(???),imag(???),angle(???),sign(????) round(??????),floor(?-inf??),ceil(?+inf??) ,fix(?0??)

    16. ??????? Matlab????????????(???????????),???????????? ??:?Matlab?,???????????????????????????????

    17. ??????? >> M=[1,2,3;4,5,6] M = 1 2 3 4 5 6 ??????????????,????? ?????[ ]?? ?????????????,??????????????

    18. ??????? >> M=[1 2 3 4 5 6] >> M=[1 2 3; 4 5 6] >> M=[1 2,3 4,5 6]

    19. ?????????matlab??? ,????? ,??????, M1=[sqrt(2),pi/2;7^(1/2),3+5i] ????

    20. ????? ??????????????(????),?????1? 0:10 0:2:10 10:-1:0 ???????????????? ?????

    21. ?????????? ??????????????(???1??),?????? M=[1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16] m=M(3,2) (Matlab?????,m?M??) a1=M(1,2:3) a2=M(2,:) a3=M(4:-1:1,2) ?????????? M(2,2)=pi

    22. ???? (?)plot 覧 ?????????? plot???: plot????????????Figure ???????????????? ???????????????,????????????????????,??????,??x, y ????????

    23. ????????????,plot?????????,????? ?????????;?????????;???????????;?????? ???????????? ????????????????

    24. plot????? plot(x) 覧 ?????????,x???, ?x???????,????????????? plot(x,y) 覧 ????,?y(x)????????????,??y?nラm???,??x ????,??m??? plot(x1,y1,x2,y2) 覧 ????????

    25. plot(x,y,痴) 覧 ????,??????s???????????, ?: plot(x1,y1,馳*,x2,y2,池O,)

    26. S????????: ?? ?? ?? ?? y ?? キ ?? m ?? ? ?? c ?? ラ ラ? r ?? + +?? g ?? - ?? b ?? ? ??? w ?? : ?? k ?? -キ (--) ???

    27. v ??? ^ ??? < ??? > ??? square ??? diamond ?? pentagram ??? hexagram ???

    28. ???????? x=[0, 0.48,0.84,1,0.91,0.6,0.14] plot(x)

    29. ???????? t=0:pi/100:2*pi; y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); plot(t,y,t,y1,t,y2)

    30. y=sin(t);y1=sin(t+0.25);y2=sin(t+0.5); y3=cos(t);y4=cos(t+0.25);y5=cos(t+0.5); plot(t,[y,y1,y2,y3,y4,y5])

    31. y3=cos(t);y4=cos(t+0.25);y5=cos(t+0.5); plot(t,y3);hold on; plot(t,y4); plot(t,y5);

    32. ?plot??????? sin,cos,tan,cot,sec,csc,asin,acos,atan,acot,asec,acsc,sinh,cosh,tanh sqrt (?????),exp (e???),pow2(2???),log(????,?e??),log10,log2,abs(????????) real(???),imag(???),angle(???),sign(????) round(??????),floor(?-inf??),ceil(?+inf??) ,fix(?0??)

    33. ?matlab?????? ?? [ ] matlab??????,?????????,????? rand 覧 ????(?0?1??????) randn 覧 ????(??????) eye 覧 ????1,???0??? zeros 覧??????0??? ones 覧??????1???

    34. >> plot(rand(1,1000)) >> plot(randn(1,1000))

    35. ???? ???????randn????????? ??N(5,2^2)

    36. ?????(+,-)?? ??: ? ???????????????????????????? ? ??????????????????????????????????? ????

    37. ???(?)?? ??: A?????????B????? ??????????? a=[1 2 3;4 5 6;7 8 0];b=[1;2;3];c=a*b c =14 32 23

    38. d=[-1;0;2];f=pi*d f = -3.1416 0 6.2832 ??????????????,???????,?matlab????????? A/B A\B

    39. a ^ p 覧 a ??p?? ????覧 a^n,a^p,p^a

    40. a=[1,2,3;4,5,6;7,8,9];a^2 ans =30 36 42 66 81 96 102 126 150

    41. inv 覧 ???? A/B=A*inv(B), A\B=inv(A)*B det 覧 ????? eig 覧 ?????? diag 覧 ???? 覧 ????(?????????) sqrt 覧 ???? ???????

    42. ????????? ????? a=[1:12];b=reshape(a,3,4) ????? rot90:??; fliplr:???; flipud:??? ????? diag:??????;tril: ?????; triu:?????

    43. ???????????????, ????????????????? ?????? ????(.+,.-) a.+b a.- b ???????

    44. ????(??,./,.\) a??b 覧 a,b?????????? ???????????? a=[1 2 3;4 5 6;7 8 9]; b=[2 4 6;1 3 5;7 9 10]; a.*b ans = 2 8 18 4 15 30 49 72 90

    45. a=[1 2 3;4 5 6;7 8 9]; b=[2 4 6;1 3 5;7 9 10]; a*b ans = 25 37 46 55 85 109 85 133 172

    46. a./b=b.\a a.\b=b./a a./b=b.\a ??a????b???? ?? a.\b=b./a ??a????b???? ?? ?: a=[1 2 3];b=[4 5 6]; c1=a.\b; c2=b./a c1 = 4.0000 2.5000 2.0000 c2 = 4.0000 2.5000 2.0000

    47. ?? A=[1,2,3;4,5,6] 2.^A (??2???????2??A??? ???) A.^2

    48. ???? ????????????????,???????(??????,?????????) max (???),min(???),sum(??),length(??),mean(???),median(???),prod(??),sort(??????)

    49. ???? size(????),det(???),rank(?),inv(???),eig(???),trace(?),norm(??)

    50. ???? Matlab?0?????,?????0??????????? ??????? &???,|???,~??? (???????) && ???, || ??? ?????? all(M) ?????,???????,???? ?????,???? any(M) ?????,???????,???? ?????,????

    51. ???? ?????: < , > , <= , >= , == , ~= ?????,????????????,?????????? ??:??????????????,?????????????? ?: 10+eps==10 10+4*eps==10 10+5*eps==10 1+eps==1

    52. ????? 1. () 2. . , , .^ , ^ 3. ????(???)+,-, ???~ 4. *, \ , / , .* , ./ , .\ 5. +, - 6. : 7. >, >=, <, <=, ==, ~= 8. & 9. | 10. && 11. ||

    53. matlab????? matlab??????????????????,??????,????,????? (1).???? 覧 ????????????? (2).???? 覧 ??????????,???????????????? ???????:

    54. ???: for i = ??? (????????) ????? end ?:??for???1!+2!+3!+ ??? +5!?? sum=0; for n=1:5 pdr=1; for k=1:n pdr=pdr*k; end sum=sum+pdr; end

    55. ? while end ?? while??????????????????? ???:while ??? ????? end ?????????????????????????,???????????;??????? ?0,????;???????0,?????

    56. ?:?while???1~100????? sum=0; n=1; while n<=100 sum=sum+n; n=n+1; end sum sum = 5050 ?:matlab??????????,??????? sum(1:100)

    57. (3). ????覧????????????? ?? if else end???3??? ? if ??? ???? end ? if ??? 覧 ? ??1 else 覧覧 ? ??2 end

    58. ? if ???1 覧 ??? ??1 elseif ???2 ??2 elseif ???3 ??3 キ キ キ else ??n end

    59. SWITCH switch_expr CASE case_expr1, statement1; CASE case_expr2 statement2; CASE case_expr2 statement3; ... OTHERWISE statements END

    60. ??????[-2,2]?????,?????

    61. ??

More Related