

下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、實用文案標準文檔自動化專業(yè)綜合設(shè)計報告設(shè)計題目:利用matlab編與S函數(shù)求解微分方程所在實驗室:自動化系統(tǒng)仿真實驗室指導(dǎo)教師:郭衛(wèi)平學(xué)生姓名律迪迪班級文自 0921學(xué)號 200990519114成績評定:_實用文案標準文檔一、設(shè)計目的了解使用 simulink 的擴展工具- S-函數(shù),s 函數(shù)可以利用 matlab 的豐富資源,而不僅僅局限于 simulink 提供的模塊,而用 c 或 C+等語言寫的 s 函數(shù)還可以實現(xiàn)對硬件端口的操 作,還可以操作 windows API 等的,它的魅力在于完美結(jié)合了simulink 框圖簡潔明快的特點和編程靈活方便的優(yōu)點,提供了增強和擴展 sin uli
2、 nk能力的強大機制,同時也是使用 RTW實現(xiàn)實時仿真的關(guān)鍵。、設(shè)計要求求解解微分方程y =y_2x/yy(o)=i要求利用 matlab 編寫 S 函數(shù)求解三、設(shè)計內(nèi)容(可加附頁)【步驟 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 的內(nèi)容。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)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 商品品質(zhì)保證函3篇
- 大學(xué)生社會實踐心得體會范文(20篇)
- 幼兒園個人研修計劃(15篇)
- 2024年中煤礦山建設(shè)集團安徽綠建科技有限公司招聘考試真題
- 2024年浙江臺州灣新區(qū)衛(wèi)生事業(yè)單位招聘衛(wèi)技人員考試真題
- 中科邁金節(jié)能技術(shù)有限公司招聘筆試真題2024
- 2024年江蘇海安經(jīng)濟技術(shù)開發(fā)區(qū)西場辦事處招聘公益性崗位人員考試真題
- 2024年河北承德醫(yī)學(xué)院附屬醫(yī)院招聘技師崗工作人員考試真題
- 成才演講稿范文(29篇)
- 紙張加工中的長效防霉技術(shù)考核試卷
- GB/T 22235-2008液體黏度的測定
- CAD輸入文字時提示“找不到主詞典無法啟動拼寫檢查程序”怎么辦
- -活出心花怒放的生命 課件 心理健康
- 給水泵檢修方案
- 設(shè)備出入庫管理辦法
- KEGG代謝通路中文翻譯
- 消火栓月檢查表
- GB∕T 17832-2021 銀合金首飾 銀含量的測定 溴化鉀容量法(電位滴定法)
- 低成本自動化的開展與案例77頁PPT課件
- 人防工程竣工資料(全套)
- 梅州市部分飲用水源保護區(qū)調(diào)整方案
評論
0/150
提交評論