ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[Âà¶K] ­z

Option Explicit
Public intRow As Integer            '¦æ¼Æ
Public intRowAll As Integer         'Á`¦æ¼Æ
Public intCol As Integer            '¦C¼Æ
Public strFileName As String        '¸ê®ÆÀÉ®×
Public strLabelName As String       '¼ÐÃD
Public intM As Integer, intN As Integer
Public V() As Double
Public M As Integer, N As Integer   '¼Æ¾ÚÂIªº¦æ¼Æ©M¦C¼Æ

'°}¦C±Æ§Çªº§Æº¸¤èªk
'«öª@¾­
'Y()¡G³Q±Æ§Çªº°}¦C
Public Sub Sort_Shell(Y() As Double)
    Dim Temp As Double, Gap As Integer
    Dim I As Integer, K As Integer, Exchage As Boolean
    K = UBound(Y)                           'Àò¨ú¤U¼Ðªº¤W¬É
    Gap = CInt((K + 1) / 2)                 '¶¡¶Zªºªì­È
    Do
        Do
            Exchage = False
            For I = 1 To K - Gap
                If Y(I) > Y(I + Gap) Then
                    Temp = Y(I)
                    Y(I) = Y(I + Gap)
                    Y(I + Gap) = Temp
                    Exchage = True
                End If
            Next I
        Loop While Exchage
        Gap = Gap / 2                       '¶¡¶ZÁY¤p¤@¥b
    Loop While Gap >= 1
End Sub
µ{¦¡¤H­û

¥»©«³Ì«á¥Ñ laigs218 ©ó 2021-7-16 08:29 ½s¿è

'¤U­±¬°ºâªk1
'X(1 To M*N)¡G­ì©l²Î­p¸ê®Æ
'M¡G²Î­p¸ê®Æªº¦æ¼Æ
'N¡G²Î­p¸ê®Æªº¦C¼Æ
'R(1 To 10)¡G´y­z²Î­pµ²ªG
Public Sub Character(X() As Double, R() As Double)
    Dim I As Integer, J As Integer, N As Integer
    Dim Max As Double, Min As Double
    Dim J3 As Integer, K3 As Integer
    N = UBound(X)
'¨D·¥¤j­È©M·¥¤p­È
    Max = X(1): Min = X(1)
    For I = 1 To N
            If X(I) > Max Then Max = X(I)
            If X(I) < Min Then Min = X(I)
    Next I
'¦pªG·¥®t¬°0»¡©ú¼Æ¦C¤¤©Ò¦³ªº¸ê®Æ³£¬Ûµ¥
    If Max - Min = 0 Then
        R(1) = X(1): R(2) = X(1): R(3) = 99999999: R(4) = X(1)
        R(5) = 0: R(6) = 0: R(7) = 0: R(8) = 0
        R(9) = 99999999: R(10) = 99999999
        Exit Sub
    End If
'¨Dºâ³N¥­§¡­È
    R(1) = 0
    For I = 1 To N
        R(1) = R(1) + X(I)
    Next I
    R(1) = R(1) / N
'¨D¤¤­È
    Sort_Shell X                    '¥Î§Æº¸¤èªk±Æ§Ç
    If (N \ 2) * 2 = N Then         '¼Æ¾Ú­Ó¼Æ¬°°¸¼Æ
        R(2) = (X(N \ 2) + X(N \ 2 + 1)) / 2
    Else                            '¼Æ¾Ú­Ó¼Æ¬°©_¼Æ
        R(2) = X(N \ 2 + 1)
    End If
'¨D²³¼Æ
'¼Æ¦C¤w¸g«ö¥Í§Ç±Æ¦n¤F¡A³o®É¥i¥H«ö²³æ¤èªk¨D²³¼Æ
    R(3) = 99999999                     '¦b¤£¦s¦bµ¥¼Æ®É²³¼ÆµL·N¸q
    J3 = 1
    K3 = 1
    I = 1: J = I + 1
    Do Until I >= N
        While X(I) = X(J)
            J3 = J3 + 1                 '¼W¥[¤@­Ó¬Ûµ¥ªº¼Æ
            J = J + 1                   '±N¹ï¤U¤@­Ó¼Æ¤ñ¸û
            If J3 > K3 Then R(3) = X(I) '§â·í«e³Ì¦hªºµ¥¼ÆÁ{®É§@¬°²³¼Æ
        Wend
        If J3 > K3 Then K3 = J3         '¦bK3¤¤«O¦s³Ì¦hªºµ¥¼Æªº­Ó¼Æ
        J3 = 1
        I = J
        J = I + 1
    Loop
µ{¦¡¤H­û

TOP

'¨ä¥¦ªº
'¨D´X¦ó¥­§¡¼Æ
    For I = 1 To N
        If X(I) <= 0 Then
            R(4) = 99999999
            GoTo 100
        End If
    Next I
    R(4) = 0
    For I = 1 To N
        R(4) = R(4) + Log(X(I))
    Next I
    R(4) = Exp(R(4) / N)
100:
'¨D½d³ò
    R(5) = Max - Min
'¨D¥­§¡®t
    R(6) = 0
    For I = 1 To N
        R(6) = R(6) + Abs(X(I) - R(1))
    Next I
    R(6) = R(6) / N
'¨D¤è®t
    R(7) = 0
    For I = 1 To N
        R(7) = R(7) + (X(I) - R(1)) ^ 2
    Next I
    R(7) = R(7) / (N - 1)
'¨D¼Ð·Ç®t
    R(8) = Sqr(R(7))
'¨D°¾«×«Y¼Æ
    R(9) = 0
    For I = 1 To N
        R(9) = R(9) + ((X(I) - R(1)) / R(8)) ^ 3
    Next I
    R(9) = R(9) * Sqr(1 / (6 * N))
'¨D®p«×«Y¼Æ
    R(10) = 0
    For I = 1 To N
        R(10) = R(10) + ((X(I) - R(1)) / R(8)) ^ 4
    Next I
    R(10) = Sqr(N / 24) * (R(10) / N - 3)
End Sub
µ{¦¡¤H­û

TOP

        ÀR«ä¦Û¦b : §ïÅܦۤv¬O¦Û±Ï¡A¼vÅT§O¤H¬O±Ï¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD