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

📄 频率分布直方图.frm

📁 饮羽公路测设(glcs) 由20多个公路测量、设计、试验和施工组织设计等小软件组成。如《中桩大地坐标》可以计算不等长缓和曲线的中桩和边桩的大地坐标;《缓和曲线反算》可以根据切线长、外距长或缓和曲线长求
💻 FRM
字号:
VERSION 5.00
Object = "{D76D7130-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSFLEX7D.OCX"
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form frmplfbzft 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "频率分布直方图"
   ClientHeight    =   4725
   ClientLeft      =   45
   ClientTop       =   345
   ClientWidth     =   6660
   Icon            =   "频率分布直方图.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4725
   ScaleWidth      =   6660
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command3 
      Caption         =   "图形"
      Height          =   375
      Left            =   2640
      TabIndex        =   12
      Top             =   4320
      Width           =   855
   End
   Begin VSFlex7DAOCtl.VSFlexGrid VSFlexGrid1 
      Height          =   3975
      Left            =   0
      TabIndex        =   3
      Top             =   720
      Width           =   2175
      _cx             =   3836
      _cy             =   7011
      _ConvInfo       =   1
      Appearance      =   1
      BorderStyle     =   1
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MousePointer    =   0
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      BackColorFixed  =   -2147483633
      ForeColorFixed  =   -2147483630
      BackColorSel    =   -2147483635
      ForeColorSel    =   -2147483634
      BackColorBkg    =   14737632
      BackColorAlternate=   -2147483643
      GridColor       =   -2147483633
      GridColorFixed  =   -2147483632
      TreeColor       =   -2147483632
      FloodColor      =   192
      SheetBorder     =   -2147483642
      FocusRect       =   3
      HighLight       =   1
      AllowSelection  =   -1  'True
      AllowBigSelection=   -1  'True
      AllowUserResizing=   3
      SelectionMode   =   0
      GridLines       =   1
      GridLinesFixed  =   2
      GridLineWidth   =   1
      Rows            =   2
      Cols            =   2
      FixedRows       =   1
      FixedCols       =   1
      RowHeightMin    =   0
      RowHeightMax    =   0
      ColWidthMin     =   0
      ColWidthMax     =   0
      ExtendLastCol   =   0   'False
      FormatString    =   ""
      ScrollTrack     =   0   'False
      ScrollBars      =   3
      ScrollTips      =   0   'False
      MergeCells      =   0
      MergeCompare    =   0
      AutoResize      =   -1  'True
      AutoSizeMode    =   0
      AutoSearch      =   0
      AutoSearchDelay =   2
      MultiTotals     =   -1  'True
      SubtotalPosition=   1
      OutlineBar      =   0
      OutlineCol      =   0
      Ellipsis        =   0
      ExplorerBar     =   0
      PicturesOver    =   0   'False
      FillStyle       =   0
      RightToLeft     =   0   'False
      PictureType     =   0
      TabBehavior     =   0
      OwnerDraw       =   0
      Editable        =   2
      ShowComboButton =   -1  'True
      WordWrap        =   0   'False
      TextStyle       =   0
      TextStyleFixed  =   0
      OleDragMode     =   0
      OleDropMode     =   0
      DataMode        =   0
      VirtualData     =   -1  'True
      ComboSearch     =   3
      AutoSizeMouse   =   -1  'True
      FrozenRows      =   0
      FrozenCols      =   0
      AllowUserFreezing=   3
      BackColorFrozen =   0
      ForeColorFrozen =   0
      WallPaperAlignment=   9
   End
   Begin VB.Frame Frame1 
      Caption         =   "原始数据"
      Height          =   615
      Left            =   0
      TabIndex        =   6
      Top             =   40
      Width           =   6615
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   5640
         TabIndex        =   2
         Text            =   "Text3"
         Top             =   240
         Width           =   855
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   3360
         TabIndex        =   1
         Text            =   "Text2"
         Top             =   240
         Width           =   855
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   1080
         TabIndex        =   0
         Text            =   "Text1"
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "公差下界值TL="
         Height          =   255
         Left            =   4440
         TabIndex        =   9
         Top             =   280
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "公差上界值TU="
         Height          =   255
         Left            =   2160
         TabIndex        =   8
         Top             =   280
         Width           =   1335
      End
      Begin VB.Label Label1 
         Caption         =   "数据总数N="
         Height          =   255
         Left            =   120
         TabIndex        =   7
         Top             =   280
         Width           =   1095
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "关闭"
      Height          =   375
      Left            =   5760
      TabIndex        =   5
      Top             =   4320
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   375
      Left            =   4800
      TabIndex        =   4
      Top             =   4320
      Width           =   855
   End
   Begin VB.Frame Frame2 
      Caption         =   "计算结果"
      Height          =   3495
      Left            =   2280
      TabIndex        =   10
      Top             =   720
      Width           =   4335
      Begin VB.ListBox List1 
         Height          =   3120
         Left            =   120
         TabIndex        =   11
         Top             =   240
         Width           =   4095
      End
      Begin MSChart20Lib.MSChart MSChart1 
         Height          =   3135
         Left            =   120
         OleObjectBlob   =   "频率分布直方图.frx":0442
         TabIndex        =   13
         Top             =   240
         Width           =   4095
      End
   End
End
Attribute VB_Name = "frmplfbzft"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim xx(), yy(), z(), zx() As Double


Private Sub Command1_Click()
'计算

    On Error GoTo handlerror

    n = Val(Text1.Text)
    tu = Val(Text2.Text)
    tl = Val(Text3.Text)
    b = Int(0.07 * n + 3)
    If n > 300 Then b = 24
    
    ReDim xx(n)
    ReDim yy(b + 2)
    ReDim z(b + 1)
    ReDim zx(b + 1)
        
    For i = 1 To VSFlexGrid1.Rows - 1
        xx(i) = Val(VSFlexGrid1.TextMatrix(i, 1))
    Next i
    S = 0
    For i = 1 To n
        S = S + xx(i)
        For j = 0 To i - 1
            If xx(i) < xx(j) Then
                abc = xx(i)
                xx(i) = xx(j)
                xx(j) = abc
            End If
        Next j
    Next i
    t = xx(n) - xx(1)
    h = t / b
    x = S / n
    S = 0
    For i = 1 To n
        S = S + (xx(i) - x) * (xx(i) - x)
    Next i
    S = Sqr(S / (n - 1))
    t1 = tu - tl
    cv = 100 * S / x
    cp = (1 - 2 * Abs(tl + t1 / 2 - x) / t1) * t1 / S / 6
    k = Abs(tu - x) / S
    Call feipin(p, k)
    p1 = p
    k = Abs(tl - x) / S
    Call feipin(p, k)
    p = (p1 + p) * 100
    
    List1.Clear
    List1.AddItem "    《频数分布直方图计算结果》"
    List1.AddItem ""
    List1.AddItem "    最大值    Xmax=" + Str(Int(xx(n) * 1000 + 0.5) / 1000)
    List1.AddItem "    最小值    Xmin=" + Str(Int(xx(1) * 1000 + 0.5) / 1000)
    List1.AddItem "    级差         R=" + Str(Int(t * 1000 + 0.5) / 1000)
    List1.AddItem "    平均值       X=" + Str(Int(x * 1000 + 0.5) / 1000)
    List1.AddItem "    标准偏差     S=" + Str(Int(S * 1000 + 0.5) / 1000)
    List1.AddItem "    变异系数    CV=" + Str(Int(cv * 1000 + 0.5) / 1000) + "%"
    List1.AddItem "    工序能力指数Cp=" + Str(Int(cp * 1000 + 0.5) / 1000)
    List1.AddItem "    可能的次品率 P=" + Str(Int(p * 1000 + 0.5) / 1000) + "%"
    
    Select Case cp
        Case Is > 1.333
            List1.AddItem "    工序能力充分"
        Case Is = 1.333
            List1.AddItem "    工序能力理想"
        Case 1 To 1.333
            List1.AddItem "    工序能力较理想"
        Case Is < 0.667
            List1.AddItem "    工序能力非常不足"
        Case Else
            List1.AddItem "    工序能力不够"
    End Select
    
    yy(1) = xx(1) - h / 2
    For i = 2 To b + 2
        yy(i) = yy(i - 1) + h
    Next i
    
    j = 2
    k = 1
    z(0) = 0
    m = 0
    w = 1
    For i = 1 To n
        If xx(i) > yy(j) Then z(k) = i - w: j = j + 1: k = k + 1: w = i
        If i = n Then z(k) = n - w + 1
        If m < z(k - 1) Then m = z(k - 1)
    Next i
    
    For i = 1 To b + 2
        c = yy(i)
        yy(i) = Int(c * 1000 + 0.5) / 1000
        If i < (b + 2) Then zx(i) = Int(z(i) / n * 1000 + 0.5) / 1000
    Next i
    
    List1.AddItem ""
    List1.AddItem ""
    List1.AddItem "    频率分布统计表:"
    List1.AddItem ""
    List1.AddItem "    ============================="
    List1.AddItem "    |编号| 分 组 区 号 |频数|相对频数|"
    List1.AddItem "    -----------------------------"
    For i = 1 To b + 1
        If i < 10 Then List1.AddItem "    |  " + Str(i) + "|" + Str(yy(i)) + "~" + Str(yy(i + 1)) + "|" + Str(z(i)) + "|" + Str(zx(i)) + "|"
        If i >= 10 Then List1.AddItem "    | " + Str(i) + "|" + Str(yy(i)) + "~" + Str(yy(i + 1)) + "|" + Str(z(i)) + "|" + Str(zx(i)) + "|"
        List1.AddItem "    -----------------------------"
    Next i
        List1.AddItem "    |合计|           " + Str(n) + "|1.00|"

    MSChart1.RowCount = b + 1

    MSChart1.ChartData = zx
    

    Exit Sub
handlerror:
    xianshi = MsgBox("在计算时出错,请检查数据后再试试。", vbInformation, "问题提示")


End Sub

Private Sub Command2_Click()
'关闭
    
    On Error GoTo handlerror
    
    If List1.ListCount > 1 And rjsfzc = 88 Then
        frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
        For i = 0 To List1.ListCount - 1
            frmMain.Text1 = frmMain.Text1 & vbCrLf & List1.List(i)
        Next i
        
        frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    原始数据:"
        For i = 0 To VSFlexGrid1.Rows - 1
            If Len(VSFlexGrid1.TextMatrix(i, 0)) = 1 Then frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + VSFlexGrid1.TextMatrix(i, 0) + "     " + VSFlexGrid1.TextMatrix(i, 1)
            If Len(VSFlexGrid1.TextMatrix(i, 0)) = 2 Then frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + VSFlexGrid1.TextMatrix(i, 0) + "    " + VSFlexGrid1.TextMatrix(i, 1)
            If Len(VSFlexGrid1.TextMatrix(i, 0)) = 3 Then frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + VSFlexGrid1.TextMatrix(i, 0) + "   " + VSFlexGrid1.TextMatrix(i, 1)
            If Len(VSFlexGrid1.TextMatrix(i, 0)) = 4 Then frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + VSFlexGrid1.TextMatrix(i, 0) + "  " + VSFlexGrid1.TextMatrix(i, 1)
        Next i
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    --------------------------------------"
    End If
    
    Unload Me
    
    Exit Sub
handlerror:

End Sub

Private Sub Command3_Click()
'图形

    ppa = 1

    If Command3.Caption = "图形" Then
        Command3.Caption = "数据"
        List1.Visible = False
        MSChart1.Visible = True
        ppa = 0
    End If
    If Command3.Caption = "数据" And ppa = 1 Then
        Command3.Caption = "图形"
        List1.Visible = True
        MSChart1.Visible = False
    End If

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
'Esc键退出,VbEscape可以用27代替
    On Error GoTo handlerror

    If KeyAscii = 27 Then
        Unload Me
    End If
    
    Exit Sub
handlerror:

End Sub

Private Sub Form_Load()
'启动

    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    
    VSFlexGrid1.TextMatrix(0, 0) = "序号"
    VSFlexGrid1.TextMatrix(0, 1) = "原始数据"
    VSFlexGrid1.ColWidth(0) = 600
    VSFlexGrid1.ColWidth(1) = 1200
    VSFlexGrid1.ColAlignment(0) = flexAlignCenterCenter
    VSFlexGrid1.ColAlignment(1) = flexAlignCenterCenter
    

End Sub

Private Sub Text1_Change()
'数据总数
    
    On Error GoTo handlerror
    
    If Val(Text1.Text) >= 3 Then
        VSFlexGrid1.Rows = Val(Text1.Text) + 1
        
        For i = 1 To VSFlexGrid1.Rows - 1
            VSFlexGrid1.TextMatrix(i, 0) = i
        Next i
    End If
    
    Exit Sub
handlerror:

End Sub


Public Sub feipin(p, k)
    '计算废品率
    p = 0
    k = k + 0.0249
    For i = 1 To 120
        p = p + 0.05 * Exp(-k * k / 2)
        k = k + 0.05
    Next i
    p = 0.398942 * p
    
End Sub

⌨️ 快捷键说明

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