

下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、實用文案標(biāo)準(zhǔn)文檔自動化專業(yè)綜合設(shè)計報告設(shè)計題目:利用matlab編與S函數(shù)求解微分方程所在實驗室:自動化系統(tǒng)仿真實驗室指導(dǎo)教師:郭衛(wèi)平學(xué)生姓名律迪迪班級文自 0921學(xué)號 200990519114成績評定:_實用文案標(biāo)準(zhǔn)文檔一、設(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,實用文案標(biāo)準(zhǔn)文檔%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:%實用文案標(biāo)準(zhǔn)文檔%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)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 教育信息化中的移動學(xué)習(xí)應(yīng)用研究
- 全球經(jīng)濟變化對經(jīng)濟學(xué)領(lǐng)域的影響
- 教育培訓(xùn)行業(yè)的市場趨勢分析報告
- 校企雙元育人中的實訓(xùn)評價標(biāo)準(zhǔn)與實施策略
- 教育心理輔導(dǎo)在教育培訓(xùn)中的作用
- 拼多多店鋪運營與SEO的完美結(jié)合
- 提升企業(yè)品牌影響力的策略探討
- 影視行業(yè)的人才培養(yǎng)與招聘策略
- 提升產(chǎn)品質(zhì)量與用戶體驗的途徑
- 2025年中國炕用鑄鐵水套散煤炊暖爐數(shù)據(jù)監(jiān)測研究報告
- 醫(yī)療器械公司咨詢培訓(xùn)記錄表(全套)-
- JJG 1000-2005電動水平振動試驗臺
- 天津地理會考知識要點精華版
- GB/T 23806-2009精細陶瓷斷裂韌性試驗方法單邊預(yù)裂紋梁(SEPB)法
- 綠殼蛋雞的養(yǎng)殖課件
- 小學(xué)語文擴句、縮句專題
- 農(nóng)村公路安全生命防護工程施工方案
- (部編版)統(tǒng)編版小學(xué)語文教材目錄(一至六年級上冊下冊齊全)
- 抗滑樁專項的施工組織方案[專家評審]
- 常用彈簧鋼號對照表
- 小學(xué)二年級下冊勞動教案
評論
0/150
提交評論