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

📄 form1.frm

📁 本软件根据路面功率谱
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4830
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6495
   LinkTopic       =   "Form1"
   ScaleHeight     =   4830
   ScaleWidth      =   6495
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   1455
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      Height          =   2895
      Left            =   0
      ScaleHeight     =   2835
      ScaleWidth      =   4755
      TabIndex        =   0
      Top             =   480
      Width           =   4815
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i, j As Integer
Dim x0 As Single
Dim Miu, Miu1 As Single
Dim sgm As Single
Dim Sumun As Single
Dim Sumun1, Sumun2 As Single
Dim x(1003) As Single
Dim wn(1003) As Single
Dim un(1003) As Single
Dim aCsp_V As Single
Dim k As Integer
Dim PicName As String
Const W1 = 0.1
Const W2 = 2
Const Csp = 0.00000016
Const v = 16.7
Const e = 2.8
'余数法生成伪随机数,然后利用伪随机数生成近似服从正态分布的wn
Private Sub Command1_Click()
k = k + 1
Picture1.Cls
Picture1.Scale (-2, 0.012)-(22, -0.012)
Picture1.Line (0, -0.01)-(22, -0.01)
For i = 1 To 4
    Picture1.CurrentX = 5 * i: Picture1.CurrentY = -0.01
    Picture1.Print 5 * i
Next i

Picture1.Line (0, -10)-(0, 10)
For i = -0.01 To 0.01 Step 0.002
    Picture1.CurrentX = -1.5: Picture1.CurrentY = i
    Picture1.Print Str(i * 1000)
Next i
'Randomize
Sumun = 0: Sumun1 = 0
line1: For i = 0 To 200
  un(i) = Rnd(0.3)
'  Debug.Print un(i), i
  
   Sumun = Sumun + un(i)
   Sumun1 = Sumun1 + un(i) * un(i)
Next i
Miu = Sumun / 201
Miu1 = Sumun1 / 201
sgm = Miu1 - Miu * Miu

Sumun = 0: Sumun1 = 0
For i = 0 To 200
 Sumun = Sumun + un(i)
 wn(i) = (Sumun - (i + 1) * Miu) / (Sqr((i + 1) * sgm))
 Debug.Print i, wn(i)
' If i = 400 Then Stop
 Sumun1 = Sumun1 + wn(i): Sumun2 = Sumun2 + wn(i) * wn(i)
Next i
Sumun1 = Sumun1 / i: Sumun2 = Sumun2 / i
sgm = Sumun2 - Sumun1 * Sumun1

aCsp_V = 2 * Csp * (2 / W1 - 1 / W2)
x(0) = aCsp_V * wn(0)
For i = 0 To 200
   x(i + 1) = e ^ (-9.5 * 20 / 200) * x(i) + Sqr(aCsp_V * (1 - e ^ (2 * (-9.5 * 20 / 200)))) * wn(i + 1)
'   Debug.Print , x(i + 1)
'   Picture1.Line (10 / 100 * i, x(i))-(10 / 100 * (i + 1), x(i + 1))
Next i
For i = 1 To 200 'Step 3
'   x(i) = -x(i - 1)
   If x(i) * x(i - 1) > 0 Then x(i) = -x(i)
   
'   Debug.Print , x(i + 1)
'   Picture1.Line (20 / 100 * i, x(i))-(20 / 100 * (i + 1), x(i + 1))
Next i
For i = 0 To 200
'   x(i + 1) = e ^ (-9.5 * 20 / 100) * x(i) + Sqr(aCsp_V * (1 - e ^ (2 * (-9.5 * 20 / 100)))) * wn(i + 1)
'   Debug.Print , x(i + 1)
   Picture1.Line (20 / 200 * i, x(i) * 2)-(20 / 200 * (i + 1), x(i + 1) * 2)
Next i
PicName = "d:\pic" + Str(k) + ".bmp"
SavePicture Picture1.Image, PicName
End Sub

Private Sub Form_Load()
'With Picture1
'    .ScaleLeft = 0
'    .ScaleTop = 0
'    .Width = Form1.Width
'    .Height = Form1.Height
'
'End With
k = 0
Picture1.Scale (-2, 0.012)-(22, -0.012)
Picture1.Line (0, -0.01)-(22, -0.01)
For i = 1 To 4
    Picture1.CurrentX = 5 * i: Picture1.CurrentY = -0.01
    Picture1.Print 5 * i
Next i

Picture1.Line (0, -10)-(0, 10)
For i = -0.01 To 0.01 Step 0.002
    Picture1.CurrentX = -1.5: Picture1.CurrentY = i
    Picture1.Print Str(i * 1000)
Next i
End Sub

⌨️ 快捷键说明

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