

下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、實用文案標準文檔自動化專業(yè)綜合設計報告設計題目:利用matlab編與S函數(shù)求解微分方程所在實驗室:自動化系統(tǒng)仿真實驗室指導教師:郭衛(wèi)平學生姓名律迪迪班級文自 0921學號 200990519114成績評定:_實用文案標準文檔一、設計目的了解使用 simulink 的擴展工具- S-函數(shù),s 函數(shù)可以利用 matlab 的豐富資源,而不僅僅局限于 simulink 提供的模塊,而用 c 或 C+等語言寫的 s 函數(shù)還可以實現(xiàn)對硬件端口的操 作,還可以操作 windows API 等的,它的魅力在于完美結合了simulink 框圖簡潔明快的特點和編程靈活方便的優(yōu)點,提供了增強和擴展 sin uli
2、 nk能力的強大機制,同時也是使用 RTW實現(xiàn)實時仿真的關鍵。、設計要求求解解微分方程y =y_2x/yy(o)=i要求利用 matlab 編寫 S 函數(shù)求解三、設計內容(可加附頁)【步驟 1】獲取狀態(tài)空間表達式。在 matlab 中輸入dsolve( Dy=y-2*x/y , y(0)=1;x)得到y(tǒng)=(2*x+1).A(1/2);【步驟 2】建立 s 函數(shù)的 m 文件。利用 21 用 S 函數(shù)模板文件。 以下是修改之后的模板文件 sfun tmpl.m 的內容。function sys,xO,str,ts = sfun tmpl(t,x,u,flag)%SFUNTMPL General M
3、-file S-fu nctio n template% With M-file S-functions, you can defi ne you own ordinary differe ntial% equati ons (ODEs), discrete system equati ons, an d/or just about% any type of algorithm to be used within a Simulink block diagram.% The gen eral form of an M-File S-fu nctio n syntax is:% SYS,XO,S
4、TR,TS = SFUNC(T,X,U,FLAG,P1,.,P n)% What is retur ned by SFUNC at a give n point in time, T, depe nds on the% value of the FLAG, the curre nt state vector, X, and the curre nt% in put vector, U.% FLAG RESULTDESCRIPTION% _ _ _% 0 SIZES,XO,STR,TS In itializatio n, return system sizes in SYS,實用文案標準文檔%i
5、n itial state in X0, state orderi ng stri ngs%in STR, and sample times in TS.%1DXReturn continuous state derivatives in SYS.%2DSUpdate discrete states SYS = X(n+1)% 3YRetur n outputs in SYS.% 4TNEXTReturn next time hit for variable step sample%time in SYS.% 5Reserved for future (root findin g).% 9Te
6、rmi natio n, perform any clea nup SYS=.% The state vectors, X and X0 con sists of con ti nu ous states followed% by discrete states.% Opti onal parameters, P1,.,P n can be provided to the S-function and% used duri ng any FLAG operati on.% When SFUNC is called with FLAG = 0, the followi ng in formati
7、o n% should be retur ned:% SYS(1) = Number of contin uous states.% SYS(2) = Number of discrete states.% SYS(3) = Number of outputs.% SYS(4) = Number of in puts.%Any of the first four eleme nts in SYS can be specified%as -1 in dicat ing that they are dyn amically sized. The%actual le ngth for all oth
8、er flags will be equal to the%len gth of the in put, U.% SYS(5) = Reserved for root finding. Must be zero.% SYS(6) = Direct feedthrough flag(仁yes, 0=n o). The s-fu ncti on%has direct feedthrough if U is used duri ng the FLAG=3%call. Setting this to 0 is akin to making a promise that%U will not be us
9、ed duri ng FLAG=3. If you break the promise%the n un predictable results will occur.% SYS(7) = Number of sample times. This is the nu mber of rows in TS.% X0= In itial state con diti ons or if no states.% STR = State orderi ng stri ngs which is gen erally specified as .% TS = An m-by-2 matrix containing the sample time%(period, offset) in formati on. Where m = nu mber of sample%times. The orderi ng of the sample times must be:%實用文案標準文檔%TS = 00,: Continu ous sample time.%01,: Continu ous, but fixed in minor step%sample time.%PERIOD OF
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 車輛開運輸發(fā)票合同協(xié)議
- 遠程醫(yī)療服務合同協(xié)議
- 河道入股協(xié)議書
- 郵送廣告制作合同協(xié)議
- 跪求個人協(xié)議合同協(xié)議
- 送菜合同協(xié)議書模板
- 運輸砂石料合同協(xié)議
- 退伙協(xié)議書退款協(xié)議
- 晉江跨鎮(zhèn)協(xié)議書
- 景區(qū)救護協(xié)議書
- 植物生理學(齊魯師范學院)知到課后答案智慧樹章節(jié)測試答案2025年春齊魯師范學院
- 2024年廣東省初中學業(yè)水平考試第一次模擬考試物理試題
- iata第 66版危險貨物規(guī)則(dgr 66th)
- 北師大版數(shù)學八年級下學期 全等三角形七大模型 知識梳理+練習 (含解析)
- 指導腎性貧血患者自我管理的中國專家共識(2024版)解讀課件
- 2023年新課標全國ⅰ卷英語真題(解析)
- 公共管理學方法論知到智慧樹章節(jié)測試課后答案2024年秋華南農業(yè)大學
- 《家禽飼養(yǎng)方式》課件
- 《裝配式碳纖維增強免拆底模鋼筋桁架樓承板(HF)應用技術標準》
- 人工智能在機能學實驗教學應用圖景的構設與挑戰(zhàn)
- Unit 6 Beautiful landscapes Integration說課稿 - 2024-2025學年譯林版英語七年級下冊
評論
0/150
提交評論