




已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第七章 Simulink 基礎(chǔ)Chapter 7: Introduction to Simulink一 Simulink 初步(Primer of Simulink)MATLAB Simulink是一個(gè)動(dòng)態(tài)仿真系統(tǒng),用于對(duì)動(dòng)態(tài)系統(tǒng)進(jìn)行仿真和分析,預(yù)先模擬實(shí)際系統(tǒng)的特性和響應(yīng),根據(jù)設(shè)計(jì)和使用要求,對(duì)系統(tǒng)進(jìn)行修改和優(yōu)化。Simulink提供了圖形化用戶界面,只須點(diǎn)擊鼠標(biāo)就可以輕易的完成模型的創(chuàng)建、調(diào)試和仿真工作,用戶不須專門掌握一種程序設(shè)計(jì)語(yǔ)言。Simulink可將系統(tǒng)分為從高級(jí)到低級(jí)的幾個(gè)層次,每層又可以細(xì)分為幾個(gè)部分,每層系統(tǒng)構(gòu)建完成后,將各層連接起來(lái)構(gòu)成一個(gè)完整系統(tǒng)。模型創(chuàng)建完成后,可以啟動(dòng)系統(tǒng)的仿真功能分析系統(tǒng)的動(dòng)態(tài)特性,其內(nèi)置的分析工具包括各種仿真算法、系統(tǒng)線性化、尋求平衡點(diǎn)等。仿真結(jié)果可以以圖形方式在示波器窗口顯示,也可將輸出結(jié)果以變量形式保存起來(lái),并輸入到MATLAB中以完成進(jìn)一步的分析。Simulink可以仿真線性和非線性系統(tǒng),并能創(chuàng)建連續(xù)時(shí)間、離散時(shí)間或二者混合的系統(tǒng)。支持多采樣頻率系統(tǒng)。Simulink Version 6.0 (R14) 05-May-2004 Model analysis and construction functions.Simulation sim - Simulate a Simulink model. sldebug - Debug a Simulink model. simset - Define options to SIM Options structure. simget - Get SIM Options structure Linearization and trimming. linmod - Extract linear model from continuous-time system. linmod2 - Extract linear model, advanced method. dlinmod - Extract linear model from discrete-time system. trim - Find steady-state operating point. Model Construction. close_system - Close open model or block. new_system - Create new empty model window. open_system - Open existing model or block. load_system - Load existing model without making model visible. save_system - Save an open model. add_block - Add new block. add_line - Add new line. delete_block - Remove block. delete_line - Remove line. find_system - Search a model. hilite_system - Hilite objects within a model. replace_block - Replace existing blocks with a new block. set_param - Set parameter values for model or block. get_param - Get simulation parameter values from model. add_param - Add a user-defined string parameter to a model. delete_param - Delete a user-defined parameter from a model. bdclose - Close a Simulink window. bdroot - Root level model name. gcb - Get the name of the current block. gcbh - Get the handle of the current block. gcs - Get the name of the current system. getfullname - get the full path name of a block slupdate - Update older 1.x models to 3.x. addterms - Add terminators to unconnected ports. boolean - Convert numeric array to boolean. slhelp - Simulink users guide or block help. Masking. hasmask - Check for mask. hasmaskdlg - Check for mask dialog. hasmaskicon - Check for mask icon. iconedit - Design block icons using ginput function. maskpopups - Return and change masked blocks popup menu items. movemask - Restructure masked built-in blocks as masked subsystems. Library. libinfo - Get library information for a system. Diagnostics. sllastdiagnostic - Last diagnostic array. sllasterror - Last error array. sllastwarning - Last warning array. sldiagnostics - Get block count and compile stats for a model. Hardcopy and printing. frameedit - Edit print frames for annotated model printouts. print - Print graph or Simulink system; or save graph to M-file. printopt - Printer defaults. orient - Set paper orientation. simulink is both a directory and a function.Copyright 1990-2004 The MathWorks, Inc. Simulink的三大步驟(procedure of Simulink):模型創(chuàng)建與定義、( Model creating and definition)模型的分析、(Model analyzing)模型的修正。(Model modifying)Simulink的運(yùn)行:(Running of Simulink)1、運(yùn)行Simulink:命令窗口下點(diǎn)擊Simulink圖標(biāo)(或鍵入Simulink命令)Simulink Library Browser(瀏覽器)simulink樹狀列表形式的模塊庫(kù)(包含simulink模塊庫(kù)中的各種模塊及其它Toolbox和 Blockset中的模塊)2、選擇建模模塊:展開樹狀列表,用鼠標(biāo)點(diǎn)擊所需類別的模塊項(xiàng), 所選模塊類的具體模塊庫(kù)就在右側(cè)的列表框中顯示出來(lái),提供建模使用。也可以在在輸入欄中鍵入模塊名并點(diǎn)擊Find按鈕進(jìn)行查詢。3、打開模型創(chuàng)建窗口:(open the window of mode creating)。在工具欄中選擇“建立新模型”的圖標(biāo),彈出名為Untitled的空白窗口,選擇Open窗口可以打開存于硬盤中已建的模型,完成模型的運(yùn)行或修改。二 Simulink 的基本模塊(basic module)simulink瀏覽器窗口左側(cè)的simulink項(xiàng)上單擊鼠標(biāo)右鍵,彈出菜單“Open the SimulinkLabrary”選項(xiàng),將打開simulink模塊庫(kù)窗口。1信號(hào)源模塊:source,模塊及功能見(表 81)2輸出模塊:Sinks, 模塊及功能見(表 82)3. 連續(xù)系統(tǒng)模塊: Continuous, 模塊及功能見(表 83)4. 離散系統(tǒng)模塊:Discrete, 模塊及功能見(表 84)5. 數(shù)學(xué)運(yùn)算模塊:Math, 模塊及功能見(表 85)6函數(shù)和表模塊: Function & Tables, 模塊及功能見(表 86)7. 非線性系統(tǒng)模塊:Nonlinear, 模塊及功能見(表 87)8. 信號(hào)與系統(tǒng)模塊:Signal & Systems, 模塊及功能見(表 88)三. Simulink 建模(Simulinc module creating)1 模塊的創(chuàng)建與操作(Creating and operation of Simulink)(1) 創(chuàng)建模塊:(module creating)()在瀏覽器列表中點(diǎn)擊需要的模塊,按住鼠標(biāo)左鍵并拖曳至模型窗口即可。()雙擊模塊可在彈出的對(duì)話框中修改相應(yīng)的模塊參數(shù)()在模塊下方名稱處雙擊可改變模塊名稱。(2)模塊操作(module operation)(a)模塊的選擇(module selection)(b)移動(dòng)模塊 (module moving)(c)模塊的縮放(modulee scaling)(d) 復(fù)制模塊:(module copy)四種方法: 在選定模塊處,按下鼠標(biāo)右鍵并拖動(dòng)至適當(dāng)位置; 選定模塊,在工具欄中(或Edit菜單中)選中Copy與Paste按鈕; 在選定的模塊處點(diǎn)擊鼠標(biāo)右鍵,在彈出的菜單中選擇Copy與Paste選項(xiàng); 按住”Ctrl”鍵,按下鼠標(biāo)左鍵,將選定的模塊拖至適當(dāng)?shù)奈恢?。(e)模塊的旋轉(zhuǎn)與翻轉(zhuǎn):(Rotating and turnover of module)旋轉(zhuǎn):(rotate)將鼠標(biāo)指向要翻轉(zhuǎn)的模塊并按下鼠標(biāo)右鍵,選擇彈出菜單中的Format欄中的Rotate項(xiàng),模塊順時(shí)針旋轉(zhuǎn)o。翻轉(zhuǎn):將鼠標(biāo)指向要翻轉(zhuǎn)的模塊并按下鼠標(biāo)右鍵,選擇彈出菜單中的Format欄中的Flip Block項(xiàng),模塊順時(shí)針旋轉(zhuǎn)180o。(f) 模塊的連接 (h)連接分支線 (i)改變連線的形狀 (j)連線的標(biāo)識(shí):在連線的上或下方(或窗口內(nèi)任何位置)雙擊鼠標(biāo)左鍵,可出現(xiàn)一個(gè)文本框用于輸入說(shuō)明文字。(3)簡(jiǎn)單模型(Simple mode) 信號(hào)發(fā)生器發(fā)生幅值為,頻率為0.2HZ的正弦波信號(hào),信號(hào)分別按倍和倍送入兩個(gè)示波器。2 模型的修飾(Mode modifying) 1. 模塊加陰影:Format菜單中的Show drop shadow菜單項(xiàng)用于給模塊加陰影。2. 調(diào)整顏色:Format菜單中的Foreground color菜單項(xiàng)用于調(diào)整模塊的前景顏色。Background color菜單項(xiàng)用于選擇模塊的背景顏色。Screen color菜單項(xiàng)用于調(diào)整屏幕顏色。3. 變換模塊名的顯示位置:Format 菜單中的Flip name可將模塊名換到對(duì)稱的位置,Hide name可將模塊名隱藏起來(lái)。4. 模塊修飾的一個(gè)簡(jiǎn)單示例三 仿真計(jì)算與分析方法(simulink calculation and the method of analyzing)1連續(xù)系統(tǒng)建模(Module creating of continuous system)(1)用積分模塊創(chuàng)建微分方程求解的模型(creating the solve mode of differential equation with integral modules): 有二階微分方程x+0.2x+0.4x=0.2u(t), u(t)是單位階躍函數(shù),演示如何用積分器直接創(chuàng)建求解該微分方程的模型。(a) 改寫微分方程為(reforming differential equation): x=0.2u(t)-0.2x-0.4x(b) 利用Simulink庫(kù)中的標(biāo)準(zhǔn)模塊建模(Creating mode with modules in the library of Simulink) :基本思路是x經(jīng)積分后得 x,再積分得 x,再將 x和 x經(jīng)代數(shù)運(yùn)算得到 x。結(jié)果送入示波器,也可同時(shí)存儲(chǔ)在工作空間變量simy中。(2)用傳遞函數(shù)模塊求解(Solving by transfer function module):以二階微分方程x+0.2x+0.4x=0.2u(t)為例, 初始狀態(tài)為0,u(t)是單位階躍函數(shù)。對(duì)方程兩邊進(jìn)行Laplace變換,得到: s2X(s)+0.2sX(s)+0.4X(s)=0.2U(s)整理后得傳遞函數(shù):(Transfer function) G(s)=X(s)/U(s)=0.2/(s2+0.2s+0.4)利用上式采用傳遞函數(shù)模塊可建立求解微分方程的模型。2. Simulink 結(jié)果的分析(Analyzing of the results): 執(zhí)行simulink后檢查輸出結(jié)果并做進(jìn)一步的分析與判斷。(1) 輸出信號(hào)的觀察(output signal observation)(a) 將信號(hào)輸出到顯示模塊(Export signal to display module)* Scope(示波器):將信號(hào)顯示在示波器的獨(dú)立窗口中,通過雙擊模塊即可打開示波器模塊。* XY Graph 顯示器模塊:在MATLAB圖形窗口繪制二維圖形, * Display模塊:將結(jié)果以數(shù)字形式顯示出來(lái),在模塊中直接滾動(dòng)顯示。標(biāo)量、矢量和矩陣形式得結(jié)果輸出窗口結(jié)構(gòu)略有不同。(b)將仿真結(jié)果存儲(chǔ)到工作空間,再用繪圖命令在命令窗口繪制圖形,(save the result of simulink to workspace and plotting figure on window by using plot command) 有三種方法可供選擇:* 通過示波器模塊向工作空間存儲(chǔ)數(shù)據(jù);* 通過選擇Sinks函數(shù)庫(kù)中的To workspace模塊,將數(shù)據(jù)保存到工作空間的simout變量中,同時(shí)還可以產(chǎn)生一個(gè)存放時(shí)間數(shù)據(jù)的變量(缺省tout);*通過Simulation菜單選擇Simulation Paremeter菜單項(xiàng)中的WorkspaceI/O頁(yè),根據(jù)各個(gè)參數(shù)的選擇來(lái)確定存儲(chǔ)的數(shù)據(jù)內(nèi)容的類型。(c). 將仿真結(jié)果通過輸出端口返回到MATLAB命令窗口,再利用繪圖命令繪出輸出圖形 (return the result of simulink from export to MATLAB window and then drawing the plot on window by using plot command) :在Sinks函數(shù)庫(kù)中有一個(gè)名為Out1的模塊,將數(shù)據(jù)輸入到這個(gè)模塊,該模塊就會(huì)將數(shù)據(jù)輸出到 MATLAB 命令窗口,并用名為 yout的變量保存,同時(shí)還將時(shí)間數(shù)據(jù)用 tout變量保存。 存儲(chǔ)在工作空間的結(jié)果可以進(jìn)行進(jìn)一步的分析。2使用一般的分析工具(the using of General analysis tool) (a). 線性化:將狀態(tài)空間所描述的線性系統(tǒng)輸入輸出關(guān)系由下式表示:x=Ax+Buy=Cx+Du其中:x 代表狀態(tài)矢量y代表輸出矢量u代表輸入矢量A,B,C,D為系統(tǒng)線性化的狀態(tài)空間矩陣 如創(chuàng)建用于線性化的系統(tǒng)模型名為lmod,并保存為”lmod.mdl”.在命令窗口輸入命令 A B C D=linmod(lmod)就可以獲得系統(tǒng)的常微分方程 lmod的狀態(tài)空間線性模型,返回系統(tǒng)線性化的狀態(tài)空間矩陣。A B C D=linmod(lmod)(A,B,C,D=LINMOD(SYS) obtains the state-space linear model of the system of ordinary differential equations described in the block diagram SYS when the state variables and inputs are set to the defaults specified in the block diagram.)(b)由狀態(tài)方程轉(zhuǎn)成LTI對(duì)象(transfer state equations to LTI object):一旦數(shù)據(jù)形成了狀態(tài)空間形式或者轉(zhuǎn)變成了LTI對(duì)象,就可以使用Control System Toolbox函數(shù)進(jìn)行進(jìn)一步的分析。利用ss函數(shù)可將上面線性化的系統(tǒng)轉(zhuǎn)成LTI對(duì)象,命令格式為: sys=ss(A,B,C,D)(c) 繪制波德圖:(Bode plot drawing) 用bode 函數(shù)可繪制波德圖,(相位、幅值與頻率的關(guān)系圖)bode(A,B,C,D) 或 bode(sys) BODE(SYS) draws the Bode plot of the LTI model SYS (created with either TF, ZPK, SS, or FRD). The frequency range and number of points are chosen automatically.(d)線性時(shí)間響應(yīng)(Linear time response):給一個(gè)階躍信號(hào)(step signal):step(A,B,C,D) 或 step(sys) 線性化階響應(yīng)或給一個(gè)脈沖信號(hào)(impulse):impulse(A,B,C,D) 或 impulse(sys)線性化脈沖響應(yīng)(e)求系統(tǒng)平衡點(diǎn)(find the balance point of
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年雷達(dá)、無(wú)線電導(dǎo)航及無(wú)線電遙控設(shè)備項(xiàng)目發(fā)展計(jì)劃
- 卵巢過度刺激綜合征護(hù)理要點(diǎn)
- 2025年水及電解質(zhì)平衡調(diào)節(jié)藥合作協(xié)議書
- 財(cái)經(jīng)投資自媒體賬號(hào)買賣及財(cái)經(jīng)資訊合作合同
- 工業(yè)級(jí)3D打印耗材倉(cāng)儲(chǔ)租賃與市場(chǎng)拓展及產(chǎn)業(yè)配套合同
- 金融理財(cái)產(chǎn)品風(fēng)險(xiǎn)評(píng)估補(bǔ)充協(xié)議
- 攝影工作室設(shè)備采購(gòu)與攝影技術(shù)培訓(xùn)、推廣、后期制作、服務(wù)及版權(quán)交易合同
- 新能源汽車充電站建設(shè)與電力設(shè)施改造合同
- 生物樣本庫(kù)建設(shè)與科研合作項(xiàng)目合作合同
- 海外留學(xué)行李安全檢查門租賃與安全評(píng)估服務(wù)協(xié)議
- 腹痛診療規(guī)范2022版
- 2023天地偉業(yè)安防產(chǎn)品技術(shù)參數(shù)和檢測(cè)報(bào)告
- 武漢煉油二期項(xiàng)目管理手冊(cè)
- 用經(jīng)濟(jì)學(xué)智慧解讀中國(guó)學(xué)習(xí)通超星課后章節(jié)答案期末考試題庫(kù)2023年
- 婚前協(xié)議書簡(jiǎn)易模板(3篇)
- 牛津英語(yǔ)上海二年級(jí)第二學(xué)期單詞及詞匯
- 《音樂治療》課程教學(xué)大綱
- 數(shù)學(xué)核心素養(yǎng)
- 華南理工大學(xué)模板課件
- 汽輪機(jī)汽封系統(tǒng)
- 2023春期版國(guó)開電大本科《政府經(jīng)濟(jì)學(xué)》形考任務(wù)4試題及答案
評(píng)論
0/150
提交評(píng)論