📄 form5.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Caption = "抽样数据的仿真"
ClientHeight = 8910
ClientLeft = 60
ClientTop = 450
ClientWidth = 10275
LinkTopic = "Form5"
ScaleHeight = 8910
ScaleWidth = 10275
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command5
Caption = "高斯分布"
Height = 375
Left = 3720
TabIndex = 19
Top = 8400
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "随机信号的仿真"
Height = 375
Left = 5520
TabIndex = 18
Top = 8400
Width = 1815
End
Begin VB.CommandButton Command3
Caption = "返回主页"
Height = 375
Left = 7920
TabIndex = 17
Top = 8400
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "均匀分布的随机数"
Height = 375
Left = 1560
TabIndex = 16
Top = 8400
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "产 生"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 7800
TabIndex = 15
Top = 120
Width = 1335
End
Begin VB.PictureBox Picture8
BackColor = &H80000009&
Height = 1575
Left = 5400
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 10
Top = 6120
Width = 4335
End
Begin VB.PictureBox Picture7
BackColor = &H80000009&
Height = 1575
Left = 720
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 9
Top = 6120
Width = 4335
End
Begin VB.PictureBox Picture6
BackColor = &H80000009&
Height = 1575
Left = 5400
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 7
Top = 4320
Width = 4335
End
Begin VB.PictureBox Picture5
BackColor = &H80000009&
Height = 1575
Left = 720
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 6
Top = 4320
Width = 4335
End
Begin VB.PictureBox Picture4
BackColor = &H80000009&
Height = 1575
Left = 5400
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 4
Top = 2520
Width = 4335
End
Begin VB.PictureBox Picture3
BackColor = &H80000009&
Height = 1575
Left = 720
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 3
Top = 2520
Width = 4335
End
Begin VB.PictureBox Picture2
BackColor = &H80000009&
Height = 1575
Left = 5400
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 1
Top = 720
Width = 4335
End
Begin VB.PictureBox Picture1
BackColor = &H80000009&
Height = 1575
Left = 720
ScaleHeight = 1515
ScaleWidth = 4275
TabIndex = 0
Top = 720
Width = 4335
End
Begin VB.Label Label7
Caption = "共抽样了四组数据,分别是第四组,第十五组,第十六组,第十一组"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 14
Top = 240
Width = 6615
End
Begin VB.Label Label6
Caption = "功 率 谱 密 度"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6480
TabIndex = 13
Top = 7920
Width = 2415
End
Begin VB.Label Label5
Caption = "自 相 关 函 数"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1560
TabIndex = 12
Top = 7920
Width = 2415
End
Begin VB.Label Label4
Caption = "第十一组数据"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1695
Left = 240
TabIndex = 11
Top = 6120
Width = 255
End
Begin VB.Label Label3
Caption = "第十六组数据"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1455
Left = 240
TabIndex = 8
Top = 4320
Width = 255
End
Begin VB.Label Label2
Caption = "第十五组数据"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1455
Left = 240
TabIndex = 5
Top = 2520
Width = 255
End
Begin VB.Label Label1
Caption = "第四组数据"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Left = 240
TabIndex = 2
Top = 840
Width = 255
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const PI = 3.1415926
Private Sub Command1_Click()
Label7.Visible = True
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Dim a As Variant, b As Variant, c As Variant, d As Variant
Dim ar(50) As Double
Dim ai(50) As Double
Dim aj(50) As Double
Dim ax(50) As Double
Dim ap(50) As Double
Dim br(50) As Double
Dim bi(50) As Double
Dim bj(50) As Double
Dim bx(50) As Double
Dim bp(50) As Double
Dim cr(50) As Double
Dim ci(50) As Double
Dim cj(50) As Double
Dim cx(50) As Double
Dim cp(50) As Double
Dim dr(50) As Double
Dim di(50) As Double
Dim dj(50) As Double
Dim dx(50) As Double
Dim dp(50) As Double
Dim m As Double
Dim n As Double
Dim q As Double
a = Array(-46.99, -43.16, -46.04, -45.56, -46.99, -46.04, -46.04, -46.51, -46.51, -47.47, -44.12, -46.04, -40.29, -42.21, -40.77, -38.86, -35.99, -35.03, -32.16, -36.46, -32.64, -36.46, -35.99, -38.38, -38.86, -42.21, -41.73, -45.56, -41.25, -44.12, -45.08, -46.04, -44.6, -45.08, -41.73, -40.77, -41.25, -40.29, -38.38, -41.25, -38.86, -41.25, -41.73, -43.64, -44.6, -43.64, -44.6, -45.08, -46.04, -45.08)
For i = 0 To 49
For j = 0 To 50 - i - 1
ar(i) = ar(i) + a(j) * a(i + j)
Next j
ar(i) = ar(i) / 50
Next i
Picture1.Cls
Picture1.Scale (-5.5, ar(0) * 7 / 5)-(5.5, -ar(0) * 7 / 5)
Picture1.Line (-5.25, 0)-(5.25, 0)
Picture1.Line (0, -ar(0) * 6 / 5)-(0, ar(0) * 6 / 5)
Picture1.Line (-0.2, ar(0) * 11 / 10)-(0, ar(0) * 6 / 5)
Picture1.Line (0.2, ar(0) * 11 / 10)-(0, ar(0) * 6 / 5)
Picture1.Line (5.15, ar(0) * 1 / 10)-(5.25, 0)
Picture1.Line (5.15, -ar(0) * 1 / 10)-(5.25, 0)
Picture1.CurrentX = -0.4: Picture1.CurrentY = -ar(0) * 2 / 15: Picture1.Print "0"
Picture1.CurrentX = 5.25: Picture1.CurrentY = -0.2: Picture1.Print "m"
Picture1.CurrentX = -1.1: Picture1.CurrentY = ar(0) * 13 / 10: Picture1.Print "R(m)"
Picture1.Line (-0.15, ar(0))-(0.15, ar(0))
Picture1.CurrentX = -1: Picture1.CurrentY = ar(0): Picture1.Print Int(ar(0))
Picture1.Line (5, ar(0) / 10)-(5, -ar(0) / 10)
Picture1.CurrentX = 4.5: Picture1.CurrentY = -ar(0) / 10: Picture1.Print 50
For j = 0 To 49
Picture1.Line (j / 10, 0)-((j) / 10, ar(j)), RGB(255, 0, 0)
Picture1.Line (-j / 10, 0)-(-(j) / 10, ar(j)), RGB(255, 0, 0)
Next j
m = 0
For k = 0 To 49
ai(k) = 0
aj(k) = 0
For j = 0 To 49
ai(k) = ai(k) + a(j) * Cos(2 * PI * k * j / 50)
aj(k) = aj(k) + a(j) * Sin(2 * PI * k * j / 50)
Next j
ax(k) = (Sqr(ai(k) * ai(k) + aj(k) * aj(k))) / 50
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -