




已閱讀5頁(yè),還剩28頁(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)試和仿真工作,用戶不須專門(mén)掌握一種程序設(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樹(shù)狀列表形式的模塊庫(kù)(包含simulink模塊庫(kù)中的各種模塊及其它Toolbox和 Blockset中的模塊)2、選擇建模模塊:展開(kāi)樹(shù)狀列表,用鼠標(biāo)點(diǎn)擊所需類別的模塊項(xiàng), 所選模塊類的具體模塊庫(kù)就在右側(cè)的列表框中顯示出來(lái),提供建模使用。也可以在在輸入欄中鍵入模塊名并點(diǎn)擊Find按鈕進(jìn)行查詢。3、打開(kāi)模型創(chuàng)建窗口:(open the window of mode creating)。在工具欄中選擇“建立新模型”的圖標(biāo),彈出名為Untitled的空白窗口,選擇Open窗口可以打開(kāi)存于硬盤(pán)中已建的模型,完成模型的運(yùn)行或修改。二 Simulink 的常用基本模塊(basic module)simulink瀏覽器窗口左側(cè)的simulink項(xiàng)上單擊鼠標(biāo)右鍵,彈出菜單“Open the SimulinkLabrary”選項(xiàng),將打開(kāi)simulink模塊庫(kù)窗口。1信號(hào)源模塊:source,模塊及功能見(jiàn)(表 81)2輸出模塊:Sinks, 模塊及功能見(jiàn)(表 82)3. 連續(xù)系統(tǒng)模塊: Continuous, 模塊及功能見(jiàn)(表 83)4. 離散系統(tǒng)模塊:Discrete, 模塊及功能見(jiàn)(表 84)5. 數(shù)學(xué)運(yùn)算模塊:Math, 模塊及功能見(jiàn)(表 85)6函數(shù)和表模塊: Function & Tables, 模塊及功能見(jiàn)(表 86)7. 非線性系統(tǒng)模塊:Nonlinear, 模塊及功能見(jiàn)(表 87)8. 信號(hào)與系統(tǒng)模塊:Signal & Systems, 模塊及功能見(jiàn)(表 88)還有:Commonly used blocks 常用模塊Discontinuous 非連續(xù)模塊Logical and bit operation 邏輯運(yùn)算和二進(jìn)制數(shù)位模塊Lookup tables 插值表Model Verification 模式識(shí)別Ports and subsystems 端口及子系統(tǒng)User defined functions 用戶自定義函數(shù)Additional math and discrete 輔助數(shù)學(xué)和離散系統(tǒng)表 81信號(hào)源模塊及功能模 塊功 能模 塊功 能In1創(chuàng)建輸入端Ground接地Constant常數(shù)Clock當(dāng)前時(shí)間SignalGeneratur信號(hào)發(fā)生器Digital Clock數(shù)字時(shí)鐘Ramp斜波From File從文件讀數(shù)據(jù)SineWave正弦波FromWorkspace從工作空間讀數(shù)據(jù)Step階躍信號(hào)Random Number隨機(jī)信號(hào)Repeating Sequence重復(fù)系列UniformRandomNumber均勻隨機(jī)信號(hào)Pulse Generator脈沖發(fā)生器Band-LimitedWhileNoise帶限白噪音Chirp Signal 快速正弦掃描 表 82輸出模塊及功能模塊功能模塊功能Scope示波器To file輸出到文件Floating Scope可選示波器To Workspace 輸出到工作空間XY GraphXY顯示器Terminator通用終端Out1創(chuàng)建輸出端Stop Simulation輸入不為0時(shí)停止仿真Display實(shí)時(shí)數(shù)據(jù)顯示 表 83連續(xù)系統(tǒng)模塊及功能模塊功能模塊功能Integrator積分Zero-Pole 零極點(diǎn)Derivative微分Memory延時(shí)輸出Statae-Space狀態(tài)方程Transport Delay傳輸延時(shí)Transfer Fcn傳遞函數(shù)VariableTransport Delay可變傳輸延時(shí) 表 84離散系統(tǒng)模塊及功能模塊功能模塊功能Zero-Order-Hold零階保持器Discrete Filter離散濾波器Unit Delay單位延時(shí)采樣保持Discrete Transfer Fcn離散傳遞函數(shù)Descrete-Time Integrator離散時(shí)間積分Discrete Zero-pole離散零極點(diǎn)Discrete-State-Space離散狀態(tài)方程First-Order Hold一階保持器 表 85數(shù)學(xué)運(yùn)算模塊及功能模塊功能模塊功能Sum求和Rounding Function取整函數(shù)Product積或商Combinatorial Logic邏輯真值表Dot Product點(diǎn)積Logical Operator邏輯算子Gain常數(shù)增益Bitwise Logical Operator位邏輯算子Slider Gain可變?cè)鲆鍾elational Operator關(guān)系算子Matrix Gain矩陣增益Complex to Magnitude-Angle復(fù)數(shù)的模和輔角Math Function數(shù)學(xué)運(yùn)算函數(shù)Magnitude-Angle to Complex模和輔角合成復(fù)數(shù)Trigonometric Function三角函數(shù)Complex to Real-Imag復(fù)數(shù)的實(shí)部和虛部NinMax求最大值Real-Imag to Complex實(shí)部和虛部合成復(fù)數(shù)Abs求絕對(duì)值A(chǔ)lgebraic Constant強(qiáng)迫輸入信號(hào)為零Sign符號(hào)函數(shù) 表 86函數(shù)和表模塊及功能模塊功能模塊功能Look-Up Table線性插值查表FcnC語(yǔ)言形式的表達(dá)式Look-Up Table (2-D)二維線性插值MATLAB Fcn MATLAB形式的表達(dá)式Look-Up Table (n-D)N維線性插值S-Function調(diào)用S-函數(shù)Prelook-Up Index Search預(yù)查下標(biāo)Polynomial多項(xiàng)式InterPolation (n-D) Using PreLook-UpN維插值S-Function Builder用C代碼創(chuàng)建S-函數(shù)Direct Look-Up Table(n-D)直接查表 表 87非線性系統(tǒng)模塊及功能模塊功能模塊功能Rate Limiter速率限制器Relay繼電器Saturation飽和元件Switch開(kāi)關(guān)Quantizer量化元件Maunal Switch手動(dòng)開(kāi)關(guān)Backlash間隙元件Multiport Switch多選開(kāi)關(guān)Dead Zone死區(qū)元件Coulomb & Viscous Friction庫(kù)侖和粘性摩擦 表 88信號(hào)與系統(tǒng)模塊及功能模塊功能模塊功能Bus Creator創(chuàng)建信號(hào)總線Data Store Memory為存儲(chǔ)器定義內(nèi)存Bus Selector從信號(hào)總線中選擇信號(hào)Data Store Write向存儲(chǔ)器寫(xiě)數(shù)據(jù)Mux多路傳輸器Function-Call Generator 函數(shù)調(diào)用發(fā)生器Demux多路分離器Reshape改變信號(hào)尺寸Selector選擇輸入信號(hào)Data Type Conversion數(shù)據(jù)類型轉(zhuǎn)換Assignment賦值Hit Crossing檢測(cè)零交叉點(diǎn)Matrix Concatenation矩陣串聯(lián)IC信號(hào)的初始值Merge信號(hào)合并Width信號(hào)的寬度From從GOTO模塊接收信號(hào)Model Info顯示模型信息Goto Tag Visibility定義GOTO模塊的范圍Signal Specification檢查信號(hào)參數(shù)Goto把信號(hào)送到From模塊Probe探測(cè)連線Data Store Read從存儲(chǔ)器讀數(shù)據(jù)可選示波器(Floating scope):可將普通示波器轉(zhuǎn)變?yōu)镕loating scope,也可在模型庫(kù)中直接選擇Floating scope模塊。利用Floating scope模塊可選擇顯示一或多個(gè)線程上的信號(hào),模塊不必與模型中的信號(hào)線連接,可以在signal selection 快捷鍵打開(kāi)的菜單中選擇要顯示的信號(hào)。*Floating scope: This option appears only on the General parameters pane for the Scope block. Selecting this option turns a Scope block into a floating scope. A floating scope is a Scope block that can display the signals carried on one or more lines. You can create a Floating Scope block in a model either by copying a Scope block from the Simulink Sinks library into a model and selecting this option or, more simply, by copying the Floating Scope block from the Sinks library into the model window. The Floating Scope block has the Floating scope parameter selected by default. To use a floating scope during a simulation, first open the scope. To display the signals carried on a line, select the line. Hold down the Shift key while clicking another line to select multiple lines. It might be necessary to click the Autoscale data button on the floating scopes toolbar to find the signal and adjust the axes to the signal values. Or you can use the floating scopes Signal Selector (see The Signal Selector in the online Simulink documentation) to select signals for display. To display a floating scopes Signal Selector, first start simulation of your model with the floating scope open. Then right-click your mouse in the floating scope and select Signal Selection from the pop-up menu that appears. You can have more than one floating scope in a model, but only one set of axes in one scope can be active at a given time. Active floating scopes show the active axes by making them blue. Selecting or deselecting lines affects the active floating scope only. Other floating scopes continue to display the signals that you selected when they were active. In other words, inactive floating scopes are locked, in that their signal displays cannot change. To specify display of a signal on one of the axes of a multiaxis floating scope, click the axis. Simulink draws a blue border around the axis. Then click the signal you want to display in the block diagram or the Signal Selector. When you run the model, the selected signal appears in the selected axis. If you plan to use a floating scope during a simulation, you should disable signal storage reuse. See Signal storage reuse in Optimizations for more information三. 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) 改寫(xiě)微分方程為(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、將MATLAB工作空間中信號(hào)矩陣作為模型輸入:利用From Workspace模塊實(shí)現(xiàn)例:模擬下述方程表達(dá)的結(jié)果 t2 (0tT)U(t)= (2T-t)2 (Tt2T) 0 (其他)(1)首先編寫(xiě)一個(gè)信號(hào)矩陣的M函數(shù)文件:function TU=source(TO,NO,K)t=linspace(0,K*TO,K*NO+1);N=length(t);u1=t(1:(NO+1).2;u2=(t(NO+2):(2*NO+1)-2*TO).2;u3(1:(N-(2*NO+2)+1)=0;u=u1,u2,u3;TU=t,u;(2)以source文件名保存,(3)然后建立一個(gè)簡(jiǎn)單的具有接收workspace信號(hào)并顯示結(jié)果的模型。(4)在命令窗口運(yùn)行TU=source(2,200,6),便在Workspace中產(chǎn)生一個(gè)TU信號(hào)矩陣。(5)再運(yùn)行所創(chuàng)建的simulink模型就可得到輸出結(jié)果。執(zhí)行simulink后檢查輸出結(jié)果并做進(jìn)一步的分析與判斷。(1) 輸出信號(hào)的觀察(output signal observation)(a) 將信號(hào)輸出到顯示模塊(Export signal to display module)* Scope(示波器):將信號(hào)顯示在示波器的獨(dú)立窗口中,通過(guò)雙擊模塊即可打開(kāi)示波器模塊。* 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) 有三種方法可供選擇:* 通過(guò)示波器模塊向工作空間存儲(chǔ)數(shù)據(jù);* 通過(guò)選擇Sinks函數(shù)庫(kù)中的To workspace模塊,將數(shù)據(jù)保存到工作空間的simout變量中,同時(shí)還可以產(chǎn)生一個(gè)存放時(shí)間數(shù)據(jù)的變量(缺省tout);*通過(guò)Simulation菜單選擇Simulation Paremeter菜單項(xiàng)中的WorkspaceI/O頁(yè),根據(jù)各個(gè)參數(shù)的選擇來(lái)確定存儲(chǔ)的數(shù)據(jù)內(nèi)容的類型。(c). 將仿真結(jié)果通過(guò)輸出端口返回到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 system):在非線性系統(tǒng)中,分析評(píng)估系統(tǒng)穩(wěn)定性或穩(wěn)定狀態(tài)時(shí)大多需要用到平衡點(diǎn)。平衡點(diǎn)是指所有狀態(tài)導(dǎo)數(shù)等于零的點(diǎn)。若僅有部分狀態(tài)導(dǎo)數(shù)等于零,則稱為偏平衡點(diǎn)。要使輸出為1,并找出輸入以及狀態(tài)值時(shí),可用”trim”函數(shù)來(lái)實(shí)現(xiàn)。以前面創(chuàng)建的”lmod”模型為例:%第一步:對(duì)狀態(tài)變量x以及輸入u做初步設(shè)定,并設(shè)定想要的輸出值。 x=0;0;0;u=0;y=1;1;%第二步:使用索引變量確定那些值可變,那些是固定不變的。 ix= ; %任何狀態(tài)值可變 iu= ; %任何輸入可變 iy=1,2; %兩個(gè)輸出不能變%第三步:調(diào)用trim函數(shù),求出系統(tǒng)平衡點(diǎn)。 x,u,y,dx=trim(lmod,x,u,y,ix,iu,iy)A,B,C,D=LINMOD(lmod) %系統(tǒng)線性化的狀態(tài)空間矩陣sys=ss(A,B,C,D) %由狀態(tài)方程轉(zhuǎn)成LTI對(duì)象figure(1)bode(sys) %繪制波德圖,(相位、幅值與頻率的關(guān)系圖)figure(2)step(A,B,C,D) %線性時(shí)間響應(yīng)x=0;0;0; %設(shè)定狀態(tài)變量u=0; %設(shè)定輸入值y=1;1; %設(shè)定想要的輸出值ix=; %表示狀態(tài)不固定iu=; %表示輸入不固定iy=1,2; %固定第一個(gè)輸出及第二個(gè)輸出x,u,y,dx=trim(lmod,x,u,y,ix,iu,iy) %求系統(tǒng)平衡點(diǎn)A = -1 0 -2 -2 1 1 0 1 0B = 0 1 0C = -2 0 0 0 0 -2D = 1 0a = x1 x2 x3 x1 -1 0 -2 x2 -2 1 1 x3 0 1 0b = u1 x1 0 x2 1 x3 0c = x1 x2 x3 y1 -2 0 0 y2 0 0 -2 d = u1 y1 1 y2 0x = 1.3333 0.0000 -0.6667u = 3.3333y = 0.6667 1.3333dx = 1.0e-015 * 0 -0.1110 0.0000Simulink命令集仿真命令sim仿真運(yùn)行一個(gè)simulink模塊sldebug調(diào)試一個(gè)simulink模塊simset設(shè)置仿真參數(shù)simget獲取仿真參數(shù)線性化和整理命令linmod從連續(xù)時(shí)間系統(tǒng)中獲取線性模型linmod2也是獲取線性模型,采用高級(jí)方法dinmod從離散時(shí)間系統(tǒng)中獲取線性模型trim為一個(gè)仿真系統(tǒng)尋找穩(wěn)定的狀態(tài)參數(shù)構(gòu)建模型命令open_system打開(kāi)已有的模型close_system關(guān)閉打開(kāi)的模型或模塊new_system創(chuàng)建一個(gè)新的空模型窗口load_system加載已有的模型并使模型不可見(jiàn)save_system保存一個(gè)打開(kāi)的模型add_block添加一個(gè)新的模塊add_line添加一條線(兩個(gè)模塊之間的連線)delete_block刪除一個(gè)模塊delete_line刪除一根線find_system查找一個(gè)模塊hilite_system使一個(gè)模塊醒目顯示replace_block用一個(gè)新模塊代替已有的模塊set_param為模型或模塊設(shè)置參數(shù)get_param獲取模塊或模型的參數(shù)add_param為一個(gè)模型添加用戶自定義的字符串參數(shù)delete_param從一個(gè)模型中刪除一個(gè)用戶自定義的參數(shù)bdclose關(guān)閉一個(gè)simulink窗口bdroot根層次下的模塊名字gcb獲取當(dāng)前模塊的名字gcbh獲取當(dāng)前模塊的句柄gcs獲取當(dāng)前系統(tǒng)的名字getfullname獲取一個(gè)模塊的完全路徑名slupdate將1.x的模塊升級(jí)為3.x的模塊addterms為未連接的端口添加terminators模塊boolean將數(shù)值數(shù)組轉(zhuǎn)化為布爾值slhelpsimulink的用戶向?qū)Щ蛘吣K幫助封裝命令hasmask檢查已有模塊是否封裝hasmaskdlg檢查已有模塊是否有封裝的對(duì)話框hasmaskicon檢查已有模塊是否有封裝的圖標(biāo)iconedit使用ginput函數(shù)來(lái)設(shè)計(jì)模塊圖標(biāo)maskpopups返回并改變封裝模塊的彈出菜單項(xiàng)movemask重建內(nèi)置封裝模塊為封裝的子模塊庫(kù)命令libinfo從系統(tǒng)中得到庫(kù)信息診斷命令sllastdiagnostic上一次診斷信息sllasterror上一次錯(cuò)誤信息sllastwarning上一次警告信息sldiagnostics為一個(gè)模型獲取模塊的數(shù)目和編譯狀態(tài)硬拷貝和打印命令frameedit編輯打印畫(huà)面print將simulink系統(tǒng)打印成圖片,或?qū)D片保存為m文件printopt打印機(jī)默認(rèn)設(shè)置orient設(shè)置紙張的方向常用Simulink模塊簡(jiǎn)介Sources庫(kù)中模塊Band-LimitedwhiteNoise給連續(xù)系統(tǒng)引入白噪聲ChirpSignal產(chǎn)生一個(gè)頻率遞增的正弦波(線性調(diào)頻信號(hào))Clock顯示并提供仿真時(shí)間Constant生成一個(gè)常量值CounterFree-Running自運(yùn)行計(jì)數(shù)器,計(jì)數(shù)溢出時(shí)自動(dòng)清零CounterLimited有限計(jì)數(shù)器,可自定義計(jì)數(shù)上限D(zhuǎn)igitalClock生成有給定采樣間隔的仿真時(shí)間FromFile從文件讀取數(shù)據(jù)FromWorkspace從工作空間中定義的矩陣中讀取數(shù)據(jù)Ground地線,提供零電平PulseGenerator生成有規(guī)則間隔的脈沖In1提供一個(gè)輸入端口Ramp生成一連續(xù)遞增或遞減的信號(hào)Rand
溫馨提示
- 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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 我的夢(mèng)想演講稿話題方向性7篇
- 朋友間的真誠(chéng)友誼寫(xiě)人作文5篇
- 音樂(lè)專業(yè)考試試題及答案
- 易溶鹽考試試題及答案
- 六一公司關(guān)愛(ài)活動(dòng)方案
- 六一創(chuàng)意足球活動(dòng)方案
- 六一小班活動(dòng)方案
- 六一攤位義賣活動(dòng)方案
- 六一檢察活動(dòng)方案
- 六一活動(dòng)創(chuàng)意活動(dòng)方案
- 2025年廣東省萬(wàn)閱大灣區(qū)百校聯(lián)盟中考二模語(yǔ)文試題(含答案)
- 護(hù)士理論考試試題及答案
- 2025年江蘇省蘇州園區(qū)星海中考英語(yǔ)二模試卷
- 福建省廈門(mén)市2023-2024學(xué)年高一下學(xué)期期末質(zhì)量檢測(cè)歷史試題(解析版)
- 工程項(xiàng)目經(jīng)理競(jìng)聘演講稿
- 賽艇考試標(biāo)準(zhǔn)
- 外墻巖棉夾芯板施工方案圖文
- 球墨鑄鐵管件項(xiàng)目可行性研究報(bào)告寫(xiě)作范文
- 小數(shù)加減法脫式計(jì)算及簡(jiǎn)便運(yùn)算100道
- MSG-3中文版課件
- 盾構(gòu)施工總結(jié)(doc106頁(yè))
評(píng)論
0/150
提交評(píng)論