⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form4.frm

📁 随机信号的课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   Caption         =   "协方差为  C(τ)=4exp(-2︱τ︱)的平稳高斯过程"
   ClientHeight    =   7845
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9870
   LinkTopic       =   "Form4"
   Picture         =   "Form4.frx":0000
   ScaleHeight     =   7845
   ScaleWidth      =   9870
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "抽样数据的仿真"
      Height          =   615
      Left            =   7320
      TabIndex        =   11
      Top             =   5520
      Width           =   1935
   End
   Begin VB.CommandButton Command6 
      Caption         =   "返回主页"
      Height          =   615
      Left            =   7320
      TabIndex        =   9
      Top             =   6600
      Width           =   1935
   End
   Begin VB.CommandButton Command5 
      Caption         =   "高斯分布的随机数"
      Height          =   615
      Left            =   7320
      TabIndex        =   8
      Top             =   4440
      Width           =   1935
   End
   Begin VB.CommandButton Command4 
      Caption         =   "[0,1]区间均匀分布的随机数"
      Height          =   615
      Left            =   7320
      TabIndex        =   7
      Top             =   3360
      Width           =   1935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "产生样本函数及其自相关函数,并计算功率谱密度"
      Height          =   975
      Left            =   7320
      TabIndex        =   6
      Top             =   1800
      Width           =   1935
   End
   Begin VB.Frame Frame3 
      Caption         =   "功率谱密度"
      Height          =   2295
      Left            =   600
      TabIndex        =   2
      Top             =   5280
      Width           =   5775
      Begin VB.PictureBox Picture3 
         BackColor       =   &H80000009&
         Height          =   1935
         Left            =   120
         ScaleHeight     =   3.307
         ScaleMode       =   7  'Centimeter
         ScaleWidth      =   9.657
         TabIndex        =   5
         Top             =   240
         Width           =   5535
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "自相关函数R(τ)"
      Height          =   2295
      Left            =   600
      TabIndex        =   1
      Top             =   2760
      Width           =   5775
      Begin VB.PictureBox Picture2 
         BackColor       =   &H80000009&
         Height          =   1935
         Left            =   120
         ScaleHeight     =   3.307
         ScaleMode       =   7  'Centimeter
         ScaleWidth      =   9.657
         TabIndex        =   4
         Top             =   240
         Width           =   5535
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "随机过程的样本函数"
      Height          =   2295
      Left            =   600
      TabIndex        =   0
      Top             =   240
      Width           =   5775
      Begin VB.PictureBox Picture1 
         BackColor       =   &H80000009&
         Height          =   1935
         Left            =   120
         ScaleHeight     =   3.307
         ScaleMode       =   7  'Centimeter
         ScaleWidth      =   9.657
         TabIndex        =   3
         Top             =   240
         Width           =   5535
      End
   End
   Begin VB.Label Label1 
      Caption         =   "数据的样本数为100"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   7200
      TabIndex        =   10
      Top             =   600
      Width           =   2055
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const PI = 3.1415926
Private Sub Command1_Click()
Label1.Visible = True
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim m As Double
Static w As Double
Dim xr(100000) As Double
Dim yr(100000) As Double
Dim wr(100000) As Double
Dim r(100000) As Double
Dim yi(100000) As Double
Dim yj(100000) As Double
Dim yp(100000) As Double
Dim s(100000) As Double
Dim t(100000) As Double
Dim x(100000) As Double
Picture1.Cls
Picture1.Scale (-1.5, 8 * 7 / 5)-(11, -8 * 7 / 5)
Picture1.Line (-1, 0)-(10.5, 0)
Picture1.Line (0, -8 * 6 / 5)-(0, 8 * 6 / 5)
Picture1.Line (-0.2, 8 * 11 / 10)-(0, 8 * 6 / 5)
Picture1.Line (0.2, 8 * 11 / 10)-(0, 8 * 6 / 5)
Picture1.Line (10.3, 0.2)-(10.5, 0)
Picture1.Line (10.3, -0.2)-(10.5, 0)
Picture1.CurrentX = -0.2: Picture1.CurrentY = -8 * 2 / 15: Picture1.Print "0"
Picture1.CurrentX = 10.5: Picture1.CurrentY = 0: Picture1.Print "x"
Picture1.CurrentX = -0.3: Picture1.CurrentY = 8 * 6 / 5: Picture1.Print "Y"
Picture1.Line (-0.1, 8)-(0.1, 8)
Picture1.Line (-0.1, -8)-(0.1, -8)
Picture1.Line (10, 8 / 15)-(10, -8 / 15)
Picture1.CurrentX = -0.5: Picture1.CurrentY = 8: Picture1.Print "4"
Picture1.CurrentX = -0.5: Picture1.CurrentY = -8: Picture1.Print "4"
Picture1.CurrentX = 9.8: Picture1.CurrentY = -8 / 10: Picture1.Print "100"
Randomize
For j = 0 To 99
a = Sqr(-2 * Log(Rnd()))
b = 2 * 3.1415926 * Rnd()
xr(j) = 2 * a * Sin(b) + m
Next j

For j = 1 To 99
yr(0) = xr(0)
i = j
yr(j) = Exp(-2) * yr(j - 1) + (2 * Sqr(1 - Exp(-2 * 2))) * xr(i)
Next j
For j = 0 To 98
Picture1.Line (j / 10, yr(j))-((j + 1) / 10, yr(j + 1))
Next j
For i = 0 To 99
For j = 0 To 100 - i - 1
 r(i) = r(i) + yr(j) * yr(i + j)
 Next j
r(i) = r(i) / 100
Next i

Picture2.Cls
Picture2.Scale (-11, 10 * 7 / 5)-(11, -10 * 7 / 5)
Picture2.Line (-10.5, 0)-(10.5, 0)
Picture2.Line (0, -10 * 6 / 5)-(0, 10 * 6 / 5)
Picture2.Line (-0.2, 10 * 11 / 10)-(0, 10 * 6 / 5)
Picture2.Line (0.2, 10 * 11 / 10)-(0, 10 * 6 / 5)
Picture2.Line (10.3, 1)-(10.5, 0)
Picture2.Line (10.3, -1)-(10.5, 0)
Picture2.CurrentX = -0.2: Picture2.CurrentY = -10 * 2 / 15: Picture2.Print "0"
Picture2.CurrentX = 10.6: Picture2.CurrentY = -0.2: Picture2.Print "m"
Picture2.CurrentX = -1.5: Picture2.CurrentY = 10 * 6 / 5: Picture2.Print "R(m)"
Picture2.Line (10, 4 / 15)-(10, -4 / 15)
Picture2.CurrentX = 9.5: Picture2.CurrentY = -4 / 10: Picture2.Print "100"
For j = 0 To 99
Picture2.Line (j / 10, 0)-((j) / 10, r(j)), RGB(255, 0, 0)
Picture2.Line (-j / 10, 0)-(-(j) / 10, r(j)), RGB(255, 0, 0)
Next j
Picture3.Cls
m = 0
For k = 0 To 99
 yi(k) = 0
 yj(k) = 0
For j = 0 To 99
 yi(k) = yi(k) + yr(j) * Cos(2 * PI * k * j / 100)
 yj(k) = yj(k) + yr(j) * Sin(2 * PI * k * j / 100)
Next j
yp(k) = (Sqr(yi(k) * yi(k) + yj(k) * yj(k))) / 100
s(k) = 20 * ((Log(yp(k)) / Log(10)))
Next k
Picture3.Cls
Picture3.Scale (-1.5, 20 * 2 / 5)-(11, -20 * 7 / 5)
Picture3.Line (0, -20)-(10.5, -20)
Picture3.Line (0, 20 / 5)-(0, -20)
Picture3.Line (-0.2, 20 / 10)-(0, 20 / 5)
Picture3.Line (0.2, 20 / 10)-(0, 20 / 5)
Picture3.Line (10.3, -(20 - 20 / 12))-(10.5, -20)
Picture3.Line (10.3, -(20 + 20 / 12))-(10.5, -20)
Picture3.Line (10, -19)-(10, -21)
Picture3.Line (-0.1, 0)-(0.1, 0)
Picture3.Line (-0.1, -10)-(0.1, -10)
Picture3.CurrentX = 10: Picture3.CurrentY = -21: Picture3.Print "2π"
Picture3.CurrentX = -0.2: Picture3.CurrentY = 0: Picture3.Print "0"
Picture3.CurrentX = -0.6: Picture3.CurrentY = -9: Picture3.Print "-10"
Picture3.CurrentX = -0.6: Picture3.CurrentY = -18: Picture3.Print "-20"
Picture3.CurrentX = 0.2: Picture3.CurrentY = -20.5: Picture3.Print "0"
Picture3.CurrentX = 10.4: Picture3.CurrentY = -20.3: Picture3.Print "ω"
Picture3.CurrentX = -1.5: Picture3.CurrentY = 20 / 5: Picture3.Print "S(ω)dB"
For j = 0 To 98
Picture3.Line (j / 10, s(j))-((j + 1) / 10, s(j + 1)), RGB(0, 255, 0)
Next j
End Sub
Private Sub Command2_Click()
Form5.Show
Unload Form4
End Sub
Private Sub Command4_Click()
Unload Form4
Form2.Show
End Sub
Private Sub Command5_Click()
Unload Form4
Form3.Show
End Sub
Private Sub Command6_Click()
Form1.Show
Unload Form4
End Sub
Private Sub Form_activate()
Label1.Visible = False
Picture1.Cls
Picture2.Cls
Picture3.Cls
Picture1.Scale (-1.5, 3.5)-(11, -3.5)
Picture1.Line (-1, 0)-(10.5, 0)
Picture1.Line (0, -3)-(0, 3)
Picture1.Line (-0.2, 2.8)-(0, 3)
Picture1.Line (0.2, 2.8)-(0, 3)
Picture1.Line (10.3, 0.2)-(10.5, 0)
Picture1.Line (10.3, -0.2)-(10.5, 0)
Picture1.CurrentX = -0.2: Picture1.CurrentY = -0.1: Picture1.Print "0"
Picture1.CurrentX = 10.5: Picture1.CurrentY = 0: Picture1.Print "x"
Picture1.CurrentX = -0.3: Picture1.CurrentY = 3: Picture1.Print "Y"
Picture2.Scale (-11, 10 * 7 / 5)-(11, -10 * 7 / 5)
Picture2.Line (-10.5, 0)-(10.5, 0)
Picture2.Line (0, -10 * 6 / 5)-(0, 10 * 6 / 5)
Picture2.Line (-0.2, 10 * 11 / 10)-(0, 10 * 6 / 5)
Picture2.Line (0.2, 10 * 11 / 10)-(0, 10 * 6 / 5)
Picture2.Line (10.3, 1)-(10.5, 0)
Picture2.Line (10.3, -1)-(10.5, 0)
Picture2.CurrentX = -0.2: Picture2.CurrentY = -10 * 2 / 15: Picture2.Print "0"
Picture2.CurrentX = 10.5: Picture2.CurrentY = 0: Picture2.Print "x"
Picture2.CurrentX = -0.3: Picture2.CurrentY = 10 * 6 / 5: Picture2.Print "Y"
Picture3.Scale (-1.5, 20 * 2 / 5)-(11, -20 * 7 / 5)
Picture3.Line (0, -20)-(10.5, -20)
Picture3.Line (0, 20 / 5)-(0, -20)
Picture3.Line (-0.2, 20 / 10)-(0, 20 / 5)
Picture3.Line (0.2, 20 / 10)-(0, 20 / 5)
Picture3.Line (10.3, -(20 - 20 / 12))-(10.5, -20)
Picture3.Line (10.3, -(20 + 20 / 12))-(10.5, -20)
Picture3.Line (10, -19)-(10, -21)
Picture3.CurrentX = 10: Picture3.CurrentY = -21: Picture3.Print "2π"
Picture3.CurrentX = 0: Picture3.CurrentY = -20.5: Picture3.Print "0"
Picture3.CurrentX = 10.4: Picture3.CurrentY = -20.3: Picture3.Print "ω"
Picture3.CurrentX = -1.5: Picture3.CurrentY = 20 / 5: Picture3.Print "S(ω)dB"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -