MATLAB數(shù)值計(jì)算繪圖模擬仿真以及使用總結(jié)_第1頁
MATLAB數(shù)值計(jì)算繪圖模擬仿真以及使用總結(jié)_第2頁
MATLAB數(shù)值計(jì)算繪圖模擬仿真以及使用總結(jié)_第3頁
MATLAB數(shù)值計(jì)算繪圖模擬仿真以及使用總結(jié)_第4頁
MATLAB數(shù)值計(jì)算繪圖模擬仿真以及使用總結(jié)_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、workl1-1command window» 12+2*(7-4)/3*2ansa»i 11 5 sdect data to name valuemb ans22command window» 12+2*(7-4)/3*2ansxworkwi。,xej? select data to .name *valuem日ans22田,0.63450.(2» s=l-l/2+l/3-l/4+l/5-l/6+l/7-l/8: » scommand history: 押 x2015/11/25 9:04 % 12+2*(7-4)/3'2 s=l-l

2、/2*l/3-l/4+l/5-l/6-»0. 6345a»1- 3command window» yl=2*sin(0. 3*pi)/(l+sqrt(5)0. 5000a»tp select data to . name valuemb ans2 2bs0.63450.syi0.50000.!<>command history嶺 ,xcommand history 3 x©%- 2015/11/25 9:04 % 12+2*(7-4)/3"21-412+2*(7-4)/3"2s=l-l/21/3-l/4+l/5-

3、l/'(-syl=2sinz0. 3pi/(1+sqrt( yl=2*sin0. 3pi/(l+sqrt yl=2*sin(0. 3*pi)/(1+s:kclcyl=2*sin(0. 3*pi)/(l+sq vvaluem220.63450.(0.50000.;0.36330.:command window? x» yl=2*sin(0. 3*pi)/(1+sqrt (5)0. 5000» y2=2*cos(0. 3*pi)/ (1+sqrt (5)0. 3633a»<>command history? xs=1-1/2+1/3-1/4+1/5

4、-1/|asyl=2sin0. 3pi/(lsqrt(yl=2*sin'o. 3pi/(l*sqrt yl=2*sin(0. 3*pi)/(l+s.clcyl=2*sin(0. 3*pi)/(hsq y2=2*cos(0. 3*pi)/(hsq v<>work22- 1command windowxworkspace? x pvp (a到戸j 松各select data to. valuemin max<8x8 double00.9706ans =0.63450.6345 0.63450.50000.5000 0.50000.363303633 0.36331000

5、00100 00010 00001 00000 1<command history>x» rand (8)ayl=2*sin0. 3pi/(l-sqrtans =yl=2*sin(0.3*pi)/(l+s-clccolumnsi through 7yl=2*sin(0.3*pi)/(l+sq:|v2=2*cos(0. 3*pi)/(l+sq:0.81470.95750.42180.67870.27690.43870. 7094eye (5)0.90580.96490.91570.75770.04620.38160. 7547rand(8)0.12700.15760. 79

6、220. 74310. 09710. 76550.2760tri 1 (ans)v0.91340.97060.95950.39220.82350. 79520.6797v<>2-1- (1)command windowxworkspace? xawj ytq sdect data to » tril(ans)valueminmax<8x8 double>00.97060.63450.6345 0.63450.50000.5000 0.5000ans -0.36330.3633 0.3633columns 1through 70.81470000000. 905

7、80. 9649000000. 12700. 15760. 79220000<>command historyx0.91340. 97060. 95950. 3922000a0. 63240. 95720. 65570. 65550. 694800yl=2*sinl0. 3pi/(l*sqrt0. 09750. 48540. 03570. 17120.31710. 48980yl=2*sin:(0. 3*pi)/(1+s.0. 27850. 80030. 84910. 70600. 95020. 44560. 1190clc0. 54690. 14190. 93400. 03180

8、. 03440. 64630. 4984yl=2*sin(0. 3*pi)/(hsq:y2=2*cos (0. 3*pi)/(卜sqcolumn 8eye(5)rand (8)0tril(ans)vfx0v<>2-2command window» x=l:2:29; » x(:)ans =workspace-i ? x113? select datato”. valueminmax<1x15 double129<15x1 double1290.6j450.63450.63450.50000.50000.50000.36330.36330.3633&l

9、t;>command history,o f x13579111315171921232527a 292-3clcyl=2*sin(0. 3*pi)/(l+sq y2=2*cos (0. 3*pi) / (l-sq. eyerand(8)tril(ans)x=l:2:29;x(:)command window口聲 x» a=diag(x)aa =columns1 through111000000000003000000000005000000000007000000000009000000000001100000000000130000000000015000000000001

10、700000000000190000000000021000000000000a o0000000000q0q0000jworkspace-xselect data to . valueminmax<15x15 double,029<1x15 double >129<15x1 double >1290.63450.63450.6345<1x1 $ym>0.50000.50000.50000.36330.36330.3633<>command history口,xeye(5)arand(8)tril(ans)x=l:2:29;x(:)a=di

11、ag(x)syms x;h a=diag(x)a=diag(x)vx=l:2:29-x(:)a=diag(x) syms x; a=diag(x) a=diag(x) size (a, l)2-3command window-? xworkspacex0000 a0? select data to -0000namevaluem0000ba<15x15 double0bx<1x15 double*100003 ans-n1515bs0.6345o.0000ex<1x1 sym>0000byi0.50000.s3y203633oj000000002300002500<

12、;>00270command history*' nxbrand (8)atri 1 (ans)00029» size (a, 1)ans15a»ovr2-4command window? xworkspace? x» b=rand(size(a)a回ri甸益囑1select data to namevaluemb =田a<15x15 double >0丑b<15x15 double>0.(田x<1x15 double>1bans1515columns 1 through 7田,0.63450.(byiby2<

13、;1x1 sym>0.50000.36330.!0. 89090.47330.93400. 74820. 81730.14500.49090.95930. 35170.12990.45050. 86870.85300.48930. 54720.83080. 56880. 08380. 08440. 62210. 33770.13860. 58530. 46940.22900. 39980.35100.9001<>0.14930. 54970.01190.91330. 25990. 51320. 3692command history口 ?xtril(ans)a0. 25750

14、.91720. 33710.15240. 80010. 40180.1112x=l:2:29;0.84070. 28580.16220.82580.43140. 07600. 7803i-x(:)0. 25430. 75720. 79430. 53830.91060. 23990. 3897a=diag(x)0.81430. 75370.31120.99610.18180.12330. 24170. 24350.38040.52850.07820.26380.18390. 4039syms x;a=diag(x)0.92930. 56780.16560. 44270.14550. 24000.

15、 09650. 35000. 07590.60200.10670.13610. 41730.1320a=diag(x)0.19660. 05400.26300. 96190. 86930. 04970. 9421size (a, 1)fx0.25110. 53080. 65410. 00460. 57970. 90270.9561 vb=rand(size(a)vcommand windowcolumns 8 through 140.05980.68680.79480.84430.40870.92890.98800.23480.18350.64430.19480.59490.73030.037

16、70.35320.36850.37860.22590.26220.48860.88520.82120.62560.81160.17070.60280.57850.91330.01540.78020.53280.22770.71120.23730.79620.04300.08110.35070.43570.22170.45880.09870.16900.92940.93900.31110.11740.96310.26190.64910.77570.87590.92340.29670.54680.33540.73170.48680.55020.43020.31880.52110.67970.647

17、70.43590.62250.18480.42420.23160.13660.45090.44680.58700.90490.50790.48890.72120.54700.30630.20770.97970.08550.62410.10680.29630.50850.30120.43890.26250.67910.65380.74470.51080.47090.11110.80100.39550.49420.18900.81760.23050.25810.02920.36740.7791workspace今1 p xj? select data to-namevaluemba<15x1

18、5 double0bb<15x15 double0.(bx<1x15 double1彐ans1515bs0.63450.(<1x1 sym>byi0.50000.!3y20.36330j>acommand historyxa2-5column 15tril(ans)x=l:2:29j;x(:)a=diag(x) syms x; a=diag(x) a=diag(x)size (a, 1) b=rand(size(a)2-6 和 2-7command window, ? x» e=d(8:4:10:13,7:l:6:9:2)e =empty matrix:

19、 6-by-0» einax=max(e(:)emax =empty matrix: o-by-1a»農(nóng)婦為夫報(bào)仇17年抓獲4孀犯 說n霄臟孚田田田田田田田田田c6田7ax<15x15 double > <15x15 double <15x15 double (<1x15 double <6x15 double>150.6345<1x1 $ym> <1x1 sym> 0.5000command history : p 11 xaclce=d(8 4 10 13,7:1:6:*卜clcsyms x y z;x&

20、#187;z>16clce=d(8:4:10:13, 7:1:6 emax=max(e(:)mcommand windowxworkspace口 戸xac % u % cp select data to » d=a. *bname *valuemba<15x15 double >0±b<15x15 double >0.(d =<15x15 double>0bx<1x15 double*1bans1515columns 1through 7田,0.63450.(ox<1x1 syw>by0.50000/0. 8909

21、000000bhy-0.36330j01. 05500000000002. 8441001. 6028000000<command history>x00002. 338800x=l:2:29;a000004. 41990-x(:)00000010. 1433a=diag(x)0000000syms x;0000000a=diag(x)0000000a=diag(x)0000000size (a, l)0000000b=rand(size(a)a?000a0八0a0d-d=a. *bvwork33- 1command windowa 0q0 1file edit view inse

22、rt tools desktop window help5? select data tovalueempty matrix: 6-by-0» emax=max(e(:)emax =empty matrix: 0-by-l» x,y,z)meshgrid(1 inspace ( » val=x. *2+y. *2+z/2;» isosurface (x, y, z, val, 16) axis equala»<15x15 double ><15x15 double ><15x15 double >(<1

23、x15 double ><6x15 double >150.6345<100x100x100 dou. <100x100x100 dou. <100x100x100 dou. v)ryf2=16:(e(:)u“,:,meshgrid(linsp. 卜 val=x. *2+y. *2+z/2; isosurface(x, y, z, val, i1 axis equal3-1- (1)command window» e=d(8:4:10:13,7:l:6:9:2)e =empty matrix: 6-by-0» eraax=n!ax<

24、e(:)eicax =empty matrix: 0-by-l» lx,y, z=meshgrid(linspace(-10,10); » val=x. "2+y. "2+z/2;» isosurface (x, y, z, val, 16) axis equala»lwork 4 4-1workspacexlj? select data to. namevalueba<15x15 doubleabb<15x15 doublebd<15x15 double>be5 emax】bx<1x15 doublee

25、sa<6x15 dcuble>bans15bs0.6345sval<100x100x100 dou.bx<100x100x100 dou.ffly<100x100x100 dou.v<>command history , y xxk2+z"2=16clce=d(8:4:10:13, 7:1:6 emax=max(e(:)y, z=nieshgrid(linsp. val=x. 2+y. '2+z/2; isosurface (x, y, z, val, h axis equalcommand window» t=o:pi 5

26、0:4*pi;» y=exp(-t/3);a»nfigure 1-rle edit viewinsert tools desktop window help1'ns 曬0» y0=(exp(-t/3). *sin(3*t); » plot(t,y, -r,t,yo, :b)workspacex3鱸殛*select data to.name avaluesa<15x15 double*asb<15x15 double>sd<15x15 double>se(e emax】田x<1x15 double田a<6x

27、15 double2 ans155s0.6345田t<1x201 double >0val<100x100x100 dou.m田x<100x100x100 dou.-v<>command historypy=exp(-t/3); y0=exp(-t/3)*sin(3*t): yo=expz(-t/3). *sin(3*t clc' t=0:pi/50:4*pi; y=exp(-t/3); y0= (exp (-t/3). *sin(3* plot(t,y, -r ,t,yo, :bovr4-2command windowb =s» c=in

28、put c 輸入一個(gè)字符: s); 輸入一個(gè)字符:s » if c>=a & c=z disp(setstr(abs(c)+l)口? x workspace口?xlpsele. name valueab|as1aqbrs-11田ds1,0,9;4,25,cbe1,2,3;4,5,6;.3 emaxfflx<1x15 doulsa<6x15 doul3 ans<3x3 logicsmlyev<>elseif c>= a & c= z disp(setstr(abs (c)-1) elseif c=o & c<= 9

29、j disp str2nwm(c) elsedisp endra»command history,口?1 x elseif c>=a & disp (setstr (abs ( elseif c=o & disp str2nwm(c) else卜disp(c):end| ovr4-2- (2)command windowbfigure 1- °file edit view insert tools desktop window helpvorkspaceifcxa &<=*» 3ans3» x=0:0. 01:4*pi

30、;» yl=sin(x);» y2=cos(x);» plot (x,yl, -r,x, y2, g)» plot (x,y 1, -r,x, y2, : ga»q d nj i k o ® 43 乂 ©口dame value3a<15x15 double*3b<15x15 double>3cifc>=.a.&<=.z"3d<15x15 double*3e03 emax3x<1x15 doublo3a<6x15 double*3 ans3jcb0.6345&l

31、t;1x201 double*select data to .m avcommand history x=0:0. 01:4*pi; yl=sin(x);卜y2=cos(x);plot(x, yl/-r ,x, y2,- plot(x, yl,-r,x, y2, : vovr4-2-3raworks 5-1- (1)command window>> a=l 2 3;舡 5 6;7009j ; >> wal 0 w;1q1oo1 2; » c=a+b;>>門ov刀-(3)gommand 工 istory lxc=a+b; > clca=l 2

32、3;4 5 6;7 b=鬥1 0 3;1 5 00 :c=a+b;0rd=>*b0v3d1門sbd -be2.2.6;5jo.e田d1.0,9:4,25 丄se(109s emax(3x<1x15 doul4250田a<6x15 doul0818三ans<3x3 logics» a=b< >command historyxjclcaans =a=l 2 3;4 5 6;7b=l 0 3;1 5 0;0101oa+b;010c000d=a. *ba=b7a»v<>|ovr5-2簡述matlab命令窗的主要作用?(1) 命令窗門(

33、command window)位于matlab操作桌面的右方,用于輸入命令并顯示除 圖形以外的所有執(zhí)行結(jié)果,是matlab的主要交互窗口。(2) matlab既可以運(yùn)行命令也可以執(zhí)行程序,在命令窗口中可以運(yùn)行單獨(dú)的命令也可以調(diào) 用程序,相當(dāng)方便,而編輯調(diào)試窗口和圖像窗口都是程序運(yùn)行結(jié)果展示窗口,可以很直觀的 對程序運(yùn)行過程中出現(xiàn)的矩陣或者是變量等等進(jìn)行監(jiān)視。(3) 在matlab命令窗口中可以看到有一個(gè)“”,該符號(hào)為命令提示符,表示matlab 正在處于準(zhǔn)備狀態(tài)。在命令提示符后輸入命令并按回車鍵后,matlab就會(huì)解釋執(zhí)行所輸入 的命令,并在命令后面給出計(jì)算結(jié)果。5-3簡述matlab繪制二維

34、圖形的一般步驟matlab繪制圖形一般采取以下7個(gè)步驟:(1) 準(zhǔn)備數(shù)據(jù)(2) 設(shè)置當(dāng)前繪圖區(qū)(3) 繪制圖形(4) 設(shè)貫閣形屮曲線和標(biāo)記點(diǎn)格式(5) 設(shè)置坐標(biāo)軸和網(wǎng)格線(6) 標(biāo)注圖形(7) 保存和導(dǎo)出圖形5-4啟動(dòng)simulink的方式有幾種?1.啟動(dòng) simulink啟動(dòng)simulink通常有三種方式:1直接從matlab指令窗口選取菜單file| new| modal命令,matlab將會(huì)打開simulink庫瀏 覽器和名為untitled的模型窗口。2)在matlab命令窗u中鍵人simulink命令,matlab將會(huì) 打開simulink庫瀏覽器。3點(diǎn)擊matlab命令窗口工具條的

35、圖標(biāo),啟動(dòng)simulink庫瀏覽器。由啟動(dòng)simulink的三種方式,要新建一個(gè)模型文件,至少可以采用兩種方式:1直接從matlab指令窗門選取菜單file|new|modal命令。2先啟動(dòng)simulink庫瀏覽器,然后點(diǎn)擊simulink庫瀏覽器的工具條屮的“新建模型”閣標(biāo),建立新的模型文件。如果模型文件己經(jīng)存在,至少有三種方法打開模型文件:1)從matlab指令窗門選取菜單 file|open 命令。2先啟動(dòng)simulink庫瀏覽器,然后點(diǎn)擊simulink庫瀏覽器的工具條中的“打開模型”圖標(biāo), 打開已經(jīng)存在的模型文件,對它進(jìn)行編輯、修改和仿真。3布matlab命令窗口中鍵人模型文件名稱,

36、不需要.mdl后綴。simulink用不同的窗口站示 模訣庫、模型號(hào)和仿真輸出圖形結(jié)果.這些窗口不是matlab圖形窗口,不能用句柄圖形命 令來操作。5-5command window » mysum=0;i=l; » while(i<=20) mysum=mysum+i i=i+l endmysumworkspacexsele.rnamevalueba1t2f3;4t5.6f asbbe2.2.6:5,10,田d10,9;4,25,c:3e3 emaxbx<1x15 doul田a<6x15 doul3 ans<3x3 logicaxavcomman

37、d history,口?xmysum(d=a. *b ha=bhmysum=o;i=l;-while(i<=20) mysum=raysum*i |-i=i+l l end5-5-1command window» c=a;10,11,12c =1 234 567 89101112» b=c(1:3, 2 3)b =2 35 68 9fxj c-r f.o .command window口 ? xworkspacen ?xmysum =aselername avalueba1,2,3;4,5,6fa190田b田cp.2.6:5j0,bd1,0.9:4,25,cbe3 emaxi =田x<1x1

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論