MATLAB課程設計_第1頁
MATLAB課程設計_第2頁
MATLAB課程設計_第3頁
MATLAB課程設計_第4頁
MATLAB課程設計_第5頁
已閱讀5頁,還剩21頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、MATLAB程序設計基礎程序設計基礎山東大學控制科學與工程學院李曉磊MATLAB的發(fā)展歷程 o MATLAB MATrix LABoratory o 20世紀七十年代后期:時任美國新墨西哥大學計算機科學系主任的Cleve Moler教授用FORTRAN設計了一組程序接口,此即萌芽狀態(tài)的MATLAB。 o 1984年成立了MathWorks公司,并把MATLAB正式推向市場。從這時起,MATLAB的內(nèi)核采用C語言編寫,而且除原有的數(shù)值計算能力外,還新增了數(shù)據(jù)圖視功能。 o 進入20世紀九十年代的時候,MATLAB已經(jīng)成為國際控制界公認的標準計算軟件。 主要版本o1993年推出MATLAB4.0版

2、本 (1)推出了SIMULINK。這是一個交互式操作的動態(tài)系統(tǒng)建模、仿真、分析集成環(huán)境。(2)開發(fā)了與外部進行直接數(shù)據(jù)交換的組件,打通了MATLAB進行實時數(shù)據(jù)分析、處理和硬件開發(fā)的道路。(3)推出了符號計算工具包。(4)Notebook 實現(xiàn)了MATLAB與Word的無縫連接。其升級版本MATLAB4.2c應用較廣泛。 o1997年,MATLAB5.0版問世,緊接著是5.1、5.2,以及和1999年春的5.3版,真正32位運算,功能強大,數(shù)值計算加快,擁有更豐富的數(shù)據(jù)類型和結(jié)構(gòu)、更友善的面向?qū)ο?、更加快速精良的圖形可視、更廣博的數(shù)學和數(shù)據(jù)分析資源、更多的應用開發(fā)工具。其中MATLAB5.3應

3、用最廣泛。o2001年推出了MATLAB6.0,直到現(xiàn)在廣泛使用的MATLAB 6.5,其界面有較大的改觀,計算速度有了比較大的改善,增加了與Java的接口 。MATLAB應用與網(wǎng)上資源o 工具箱 信號處理、神經(jīng)網(wǎng)絡、魯棒控制、系統(tǒng)辨識、控制系統(tǒng)、圖形處理、模糊邏輯、小波分析、金融管理、概率統(tǒng)計、非線性控制等。o 網(wǎng)絡資源 MATLAB安裝o 硬件要求 x86:o 軟件要求 Windows: Linux: Adobe acrobat readerMATLAB程序執(zhí)行方式o 立即執(zhí)行 3.5*6.2ans = 21.7000 exp(j*3*pi/4)ans = -0.7071 + 0.7071

4、i o M文件:純文本文件,擴展名為M,用任何字處理軟件都可以編輯修改。?type exa1.m%This is an example.exp(j*3*pi/4)?exa1ans = -0.7071 + 0.7071iMATLAB命令窗口o 計算機安裝好MATLAB之后,雙擊MATLAB圖標,就可以進入命令窗口,此時意味著系統(tǒng)處于準備接受命令的狀態(tài),可以在命令窗口中直接輸入命令語句。o 通用命令 cd 顯示或改變工作目錄 hold 圖形保持開關(guān) dir 顯示目錄下的文件disp 顯示變量或文字內(nèi)容 type 顯示文件內(nèi)容path 顯示搜索目錄 clear 清理內(nèi)存變量save 保存內(nèi)存變量到指

5、定文件 clf 清除圖形窗口load 加載指定文件的變量 pack 收集內(nèi)存碎片diary 日志文件 clc 清除工作窗quit 退出MATLAB echo 工作窗信息顯示開關(guān)! 調(diào)用dos命令o 命令行鍵盤技巧 調(diào)用上一行home 光標置于當前行開頭 調(diào)用下一行end 光標置于當前行末尾 光標左移一個字符esc 清除當前輸入行 光標右移一個字符del 刪除光標處的字符 Ctrl 光標左移一個單詞backspace 刪除光標前的字符 Ctrl 光標右移一個單詞altbackspace 恢復上一次的刪除o 標點 : 具有多種應用功能. 小數(shù)點及域訪問符 ;區(qū)分行,取消運行顯示等 續(xù)行符 ,區(qū)分列

6、,函數(shù)參數(shù)分隔符% 注釋標記 () 指定運算先后次序! 調(diào)用操作系統(tǒng)運算 矩陣定義標志 賦值標記 用于構(gòu)成單元數(shù)組 字符串標示符MATLAB搜索路徑o MATLAB的一切操作都是在其搜索路徑中進行的,如果調(diào)用的函數(shù)在搜索路徑之外,系統(tǒng)將認為該函數(shù)不存在。o 路徑設置方法l 1、通過對話框設置 在MATLAB主窗口菜單中【file】【set Path】選項。l 2、path命令?pathMATLABPATHE:MATLABworksE:MATLABtoolboxmatlabgeneralE:MATLABtoolboxmatlabopsE:MATLABtoolboxmatlablangE:MATL

7、ABtoolboxmatlabelmatE:MATLABtoolboxmatlabelfunE:MATLABtoolboxmatlabspecfunE:MATLABtoolboxmatlabmatfunE:MATLABtoolboxmatlabdatafunE:MATLABtoolboxmatlabpolyfun 2.1 path命令?genpathans =E:MATLABtoolboxmatlabdatafun;E:MATLABtoolboxmatlabdatatypes;E:MATLABtoolboxmatlabdemos;E:MATLABtoolboxmatlabelfun;E:MAT

8、LABtoolboxmatlabelmat;E:MATLABtoolboxmatlabfunfun;E:MATLABtoolboxmatlabgeneral;E:MATLABtoolboxmatlabgraph2d;E:MATLABtoolboxmatlabgraph3d;E:MATLABtoolboxmatlabgraphics;E:MATLABtoolboxmatlabiofun;E:MATLABtoolboxmatlabiofunsrc;E:MATLABtoolboxmatlablang;E:MATLABtoolboxmatlabmatfun;2.2 genpath命令2.3 editp

9、ath或pathtool命令2.4 擴展搜索路徑 將新目錄擴展到搜索路徑中 1、用path命令 ?path(path,e:matlabworks) 2、用addpath命令 將新目錄加到搜索路徑的末尾 ?addpath e:matlabworks end 將新目錄加到搜索路徑的開始 ?addpath e:matlabworks -begin 3、使用路徑設置對話框MATLAB幫助o MATLAB Help 完善的HTML格式聯(lián)機幫助系統(tǒng),非常全面。使用方法: 1.從help菜單中選取; 2.在命令窗口中執(zhí)行helpdesk或doc。o PDF文檔 用Adobe acrobat reader閱讀

10、。Help系列o helpwino Help?helpHELP topics:matlabgeneral - General purpose commands.matlabops - Operators and special characters.matlablang - Programming language constructs.matlabelmat - Elementary matrices and matrix manipulation.matlabelfun - Elementary math functions.matlabspecfun - Specialized math

11、 functions.matlabmatfun - Matrix functions - numerical linear algebra.matlabdatafun - Data analysis and Fourier transforms. For more help on directory/topic, type help topic.o Help + 函數(shù)(類)名?help general General purpose commands. MATLAB Toolbox Version 5.2 18-Dec-1997 General information help - On-li

12、ne help, display text at command line. helpwin - On-line help, separate window for navigation. helpdesk - Comprehensive hypertext documentation and troubleshooting. demo - Run demonstrations. ver - MATLAB, SIMULINK, and toolbox version information. See also PUNCT.?help helpwin HELPWIN On-line help,

13、separate window for navigation. HELPWIN TOPIC opens a help window and displays the help text for the given TOPIC. Links are created to functions referenced in the See Also line of the help text. HELPWIN(HELP_STR,TITLE) displays the string HELP_STR in the help window. HELP_STR may be passed in as a s

14、tring with each line separated by carriage returns, a column vector cell array of strings with each cell (row) representing a line or as a string matrix with each row representing a line. The optional string TITLE will appear in the title edit box. HELPWIN(TITLE1 HELP_STR1;TITLE2 HELP_STR2;.,PAGE) d

15、isplays one page of multi-page help text. The multi-page help text is passed in as a cell array of strings or cells containing TITLE and HELP_STR pairs. Each row of the multi-page help text cell array (dimensioned number of pages by 2) consists of a title string paired with a string, cell array or s

16、tring matrix of help text. The second argument PAGE is a string which must match one of the TITLE entries in the multi-page help text. The matching TITLE represents the page that is to be displayed first. If no second argument is given, the first page is displayed. A third argument may be passed to

17、HELPWIN which is a string that becomes the title of the help window figure. Additional arguments, after the window title, will be interpreted as Handle Graphics parameter-value pairs to be applied to the text displayed in the help window. Examples. helpwin plot helpwin(Help String,title) helpwin(Hel

18、p text for sprintf(n) my m-file.,title) helpwin(Help String for;my m-file,title) helpwin(str,Topic 2,My Title) where, str = Topic 1 Help string for Topic 1; Topic 2 Help string for Topic 2; Topic 3 Help string for Topic 3 See also DOC, DOCOPT, HELP, WEB.o Lookfor 根據(jù)用戶提供的關(guān)鍵字搜索相關(guān)的函數(shù)。?lookfor diffSETDIFF Set difference.DIFF Difference and approximate derivative.POLYDER Differentiate polynomial.ODE113 Solve non-stiff differential equations, variable order method.ODE15S Solve stiff differential equations, variable order method.ODE23 Solve non-stiff diffe

溫馨提示

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

評論

0/150

提交評論