計(jì)算機(jī)仿真龍格庫(kù)塔方法的軟件VB設(shè)計(jì)與實(shí)現(xiàn)

上傳人:w****3 文檔編號(hào):48944776 上傳時(shí)間:2022-01-16 格式:DOC 頁(yè)數(shù):7 大?。?48KB
收藏 版權(quán)申訴 舉報(bào) 下載
計(jì)算機(jī)仿真龍格庫(kù)塔方法的軟件VB設(shè)計(jì)與實(shí)現(xiàn)_第1頁(yè)
第1頁(yè) / 共7頁(yè)
計(jì)算機(jī)仿真龍格庫(kù)塔方法的軟件VB設(shè)計(jì)與實(shí)現(xiàn)_第2頁(yè)
第2頁(yè) / 共7頁(yè)
計(jì)算機(jī)仿真龍格庫(kù)塔方法的軟件VB設(shè)計(jì)與實(shí)現(xiàn)_第3頁(yè)
第3頁(yè) / 共7頁(yè)

下載文檔到電腦,查找使用更方便

10 積分

下載資源

還剩頁(yè)未讀,繼續(xù)閱讀

資源描述:

《計(jì)算機(jī)仿真龍格庫(kù)塔方法的軟件VB設(shè)計(jì)與實(shí)現(xiàn)》由會(huì)員分享,可在線閱讀,更多相關(guān)《計(jì)算機(jī)仿真龍格庫(kù)塔方法的軟件VB設(shè)計(jì)與實(shí)現(xiàn)(7頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。

1、計(jì)算機(jī)仿真(龍格庫(kù)塔方法)的軟件 VB 設(shè)計(jì)與實(shí)現(xiàn) Dim a(0 To 10) As Single, b(0 To 10) As Single, c(0 To 10) As Single, d(0 To 10) As Single Dim e(0 To 10) As Single, h(0 To 10) As Single, p(0 To 10) As Single, q(0 To 10) As Single Dim n1 As Byte, n2 As Byte n1 表示的是 y 的階數(shù) ,n2 表示的是輸入函數(shù)的階數(shù) Dim i As Integer Dim f(0 To 2

2、000) As Single f(m)=y, 也就是各個(gè)時(shí)刻 的y值 Dim X0(0 To 12) As Single, X1(0 To 12) As Single Dim dt As Single, u As Single dt 為采樣周期 ,u 為輸入 Dim q1 As Single, p1 As Single, h1 As Single, e1 As Single Dim b0(0 To 10) As Single, bn(-4 To 10) As Single Dim m As Integer Dim max As Single Private Sub Combo1_

3、Click() n1 表示的是 y 的階數(shù) n1 = Combo1.ListIndex + 1 For i = n1 + 1 To 8 Text1(i).Visible = False Label1(i).Visible = False Label9(i).Visible = False Next For i = 0 To n1 Text1(i).Visible = True Label1(i).Visible = True Label9(i).Visible = True Next Combo2.Clear Combo2.Text = " 請(qǐng)選擇輸出 u 的最大階數(shù)

4、" For i = 0 To n1 Combo2.AddItem ((i) & " 階 ") Next End Sub n2 表示的是輸入函數(shù)的階數(shù) Private Sub Combo2_Click() n2 = Combo2.ListIndex For i = n2 + 1 To 8 Text2(i).Visible = False Label2(i).Visible = False Label10(i).Visible = False Next For i = 0 To n2 Text2(i).Visible = True Label2(i).Visible = Tr

5、ue Label10(i).Visible = True Next End Sub Private Sub Calculate_Click() dt = Val(Text3.Text) dt 是采樣周期 u = Val(Text4.Text) n1 = Combo1.ListIndex + 1 If n1 = 0 Then 對(duì)付忘記選擇最高階數(shù)時(shí)的情況 Call MsgBox(" 請(qǐng)選擇階數(shù)! ", 48, " 未選擇階數(shù) ") Exit Sub End If For i = 0 To 12 設(shè)X0的初值都是0,且i大于8,這一點(diǎn)很重要! X0(i) = 0 Next

6、 For i = 0 To n1 - 1 a(i)b(i)c(i)d(i) 等等都是計(jì)算的中間 a(i) = -Val(Text1(i).Text) / Val(Text1(n1).Text) 變量 Next For i = 0 To n2 b0(i) = Val(Text2(i).Text) / Val(Text1(n1).Text) Next If Combo3.ListIndex = 1 Then n1 = n1 + 1 For i = n1 - 1 To 1 Step -1 a(i) = a(i - 1) Next a(0) = 0 End If For i

7、= -4 To -1 bn(i) = 0 Next b(0) = a(0) * a(n1 - 1) For i = 1 To n1 - 1 b(i) = a(i - 1) + a(i) * a(n1 - 1) Next c(0) = a(0) * b(n1 - 1) For i = 1 To n1 - 1 c(i) = b(i - 1) + a(i) * b(n1 - 1) Next d(0) = a(0) * c(n1 - 1) For i = 1 To n1 - 1 d(i) = c(i - 1) + a(i) * c(n1 - 1) Next For i =

8、 0 To n1 - 1 e(i) = dt * a(i) + dt * dt / 2 * b(i) + dt * dt * dt / 6 * c(i) + dt * dt * dt * dt / 24 * d(i) h(i) = dt * dt / 2 * a(i) + dt * dt * dt / 6 * b(i) + dt * dt * dt * dt / 24 * c(i) p(i) = dt * dt * dt / 6 * a(i) + dt * dt * dt * dt / 24 * b(i) q(i) = dt * dt * dt * dt / 24 * a(i) Next

9、 If n2 = 0 Then n2 為 0 和不為 0 的公式是不一樣的,表示輸入函數(shù) u 為 n2 階 b0(0) = Val(Text2(0).Text) / Val(Text1(n1).Text) m = 1 Do q1 = 0: p1 = 0: h1 = 0: e1 = 0 For i = 0 To n1 - 1 這些個(gè)也是中間變量 q1 = q1 + q(i) * X0(i + 1) p1 = p1 + p(i) * X0(i + 1) h1 = h1 + h(i) * X0(i + 1) e1 = e1 + e(i) * X0(i + 1) Next F

10、or i = 1 To n1 X1(i) = X0(i) + dt * X0(i + 1) + dt * dt / 2 * X0(i + 2) + dt * dt * dt / 6 * X0(i + 3) + dt * dt * dt * dt / 24 * X0(i + 4) Next X1(n1) = X1(n1) + e1 + (dt + dt * dt / 2 * a(n1 - 1) + dt * dt * dt / 6 * b(n1 - 1) + dt * dt * dt * dt / 24 * c(n1 - 1)) * b0(0) * u If n1 >= 4 Then

11、 X1(n1 - 3) = X1(n1 - 3) + q1 + dt * dt * dt * dt / 24 * b0(0) * u X1(n1 - 2) = X1(n1 - 2) + p1 + (dt * dt * dt / 6 + dt * dt * dt * dt / 24 * a(n1 - 1)) * b0(0) * u X1(n1 - 1) = X1(n1 - 1) + h1 + (dt * dt / 2 + dt * dt * dt / 6 * a(n1 - 1) + dt * dt * dt * dt / 24 * b(n1 - 1)) * b0(0) * u ElseIf

12、 n1 >= 3 Then X1(n1 - 2) = X1(n1 - 2) + p1 + (dt * dt * dt / 6 + dt * dt * dt * dt / 24 * a(n1 - 1)) * b0(0) * u X1(n1 - 1) = X1(n1 - 1) + h1 + (dt * dt / 2 + dt * dt * dt / 6 * a(n1 - 1) + dt * dt * dt * dt / 24 * b(n1 - 1)) * b0(0) * u ElseIf n1 >= 2 Then X1(n1 - 1) = X1(n1 - 1) + h1 + (dt * d

13、t / 2 + dt * dt * dt / 6 * a(n1 - 1) + dt * dt * dt * dt / 24 * b(n1 - 1)) * b0(0) * u End If f(m) = X1(1) For i = 1 To n1 X0(i) = X1(i) Next m = m + 1 Loop Until m = 2000 循環(huán)計(jì)算 2000 次 Else For i = (n2 + 1) To 10 b0(i) = 0 Next For i = 0 To n1 - 1 bn(i) = b0(i) + b0(n1) * a(i) Next Do

14、 For i = 1 To n1 X1(i) = X0(i) + dt * X0(i + 1) + dt * dt / 2 * X0(i + 2) + dt * dt * dt / 6 * X0(i + 3) + dt * dt * dt * dt / 24 * X0(i + 4) + (h(n1 - i) * bn(n1 - 1) + p(n1 - i) * bn(n1 - 2) + q(n1 - i) * bn(n1 - 3)) * u Next For i = 1 To n1 X1(i) = X1(i) + e(n1 - i) * X0(1) + h(n1 - i) *

15、X0(2) + p(n1 - i) * X0(3) + q(n1 - i) * X0(4) + (dt * bn(n1 - i) + dt * dt / 2 * bn(n1 - 1 - i) + dt * dt * dt / 6 * bn(n1 - 2 - i) + dt * dt * dt * dt / 24 * bn(n1 - 3 - i)) * u Next f(m) = X1(1) For i = 1 To n1 X0(i) = X1(i) Next m = m + 1 Loop Until m = 2000 End If max = f(1) For m = 2 To

16、 1999 開始繪圖 If Abs(f(m)) > Abs(max) Then max = f(m) End If Next If max > 0 Then Picture1.Cls Picture1.Scale (-20 * dt, 1.2 * max)-(2020 * dt, -0.05 * max) Picture1.Line (0, 0)-(2002 * dt, 0) Picture1.Line (0, 0)-(0, 1.18 * max) Picture1.Line (2002 * dt, 0)-(1960 * dt, -0.025 * max) Picture

17、1.Line (2002 * dt, 0)-(1960 * dt, 0.025 * max) Picture1.Line (0, 1.18 * max)-(10 * dt, 1.1 * max) Picture1.Line (0, 1.18 * max)-(-10 * dt, 1.1 * max) Else Picture1.Cls Picture1.Scale (-5 * dt, 0.2 * Abs(max))-(2002 * dt, 1.2 * max) Picture1.Line (0, 0)-(2002 * dt, 0) Picture1.Line (0, 0)-

18、(0, 1.2 * max) Picture1.Line (2002 * dt, 0)-(1900 * dt, 0.1 * max) Picture1.Line (0, 1.2 * max)-(50 * dt, 1.1 * max) End If For m = 2 To 1999 Picture1.Line ((m - 1) * dt, f(m - 1))-(m * dt, f(m)), vbRed Next If (f(1999) - f(1800)) < 0.00001 Then Picture1.Line (0, f(1999))-(2000 * dt, f(199

19、9)) Picture1.CurrentX = 0 Picture1.CurrentY = f(1999) + 0.1 * max Picturel.Print "y g =" & f(1999) End If If Combo3.ListIndex = 0 Then Picture1.Line (0, f(1999))-(2000 * dt, f(1999)) Picture1.CurrentX = 0 Picture1.CurrentY = f(1999) + 0.1 * max Picture1.Print "y g =" & f(1999) Else Pictu

20、re1.Line (0, 0)-(2000 * dt, u * 2000 * dt) End If End Sub Private Sub Combo3_Click() Text4.Visible = True Label12.Visible = True If Combo3.ListIndex = 0 Then Label5.Caption ="請(qǐng)輸入階躍信號(hào) u的系數(shù):” Else Label5.Caption = " 請(qǐng)輸入斜坡信號(hào) u 的系數(shù): End If End Sub Private Sub dtxnzb_Click() Dim y00 As Single

21、 Dim thigema As Single Dim ts As Single Dim ess As Single If Combo3.List In dex = 0 Then yOO = f(1999) thigema = max - y00 m = 2000 Do Loop Un til Abs(f(m) - y00) >= (0.05 * yOO) ts = m * dt ess = u - y00 Framel.Visible = =True Label6.Capti on = ="超調(diào)量d :"& thigema Label7.Capti on = ="調(diào)節(jié)時(shí)間 ts:" & ts Label8.Capti on = ="穩(wěn)態(tài)誤差 ess:" & ess Else Framel.Visible = True Label6.Caption ="穩(wěn)態(tài)誤差 ess:" & (u * 1999 * dt - f(1999)) / (u * 1999 * dt) & "%" End If End Sub

展開閱讀全文
溫馨提示:
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. 裝配圖網(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ì)自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!

五月丁香婷婷狠狠色,亚洲日韩欧美精品久久久不卡,欧美日韩国产黄片三级,手机在线观看成人国产亚洲