Step Response Simulation of an RIAA Equalization Filter

Dim B0(4), B1(4), A0(4), A1(4), Reg(4), Out, Temp, Reg As Double
Private Sub Form_Load()
    'Step response of an RIAA equalization filter
    'Sample rate = 192 kHz, coefficients for an impulse invariant transformation
    'Refer to
http://beis.de/Elektronik/Filter/AnaDigFilt/1stOrderDigFilt.html#RIAA
    'Stage 1
    B0(1) = 1
    B1(1) = -1
    A0(1) = 1
    A1(1) = -0.99934544
    'Stage 2
    B0(2) = 0.0016378
    B1(2) = 0
    A0(2) = 1
    A1(2) = -0.99836216
    'Stage 3
    B0(3) = 61.056
    B1(3) = -60.056
    A0(3) = 1
    A1(3) = 0
    'Stage 4
    B0(4) = 0.0694444
    B1(4) = 0
    A0(4) = 1
    A1(4) = -0.9305555
    'Simulation runs 60 ms = 192 * 60 samples (192 samples per ms)
    For T = 0 To 60         '60 ms
        Debug.Print T;      'ms number
        Debug.Print Out     'Filter output value
        For I = 1 To 192    '192 samples per ms
            Out = 1         'Filter input value for an initial step = 1
            'The filter process for one sample:
            For K = 1 To 4                          '4 stages
                Temp = Out - Reg(K) * A1(K)         'This input = previous output
                Out = B0(K) * Temp + B1(K) * Reg(K) 'This output = next input
                Reg(K) = Temp
            Next K
        Next I
    Next T
    Debug.Print "-------------------------"
    End
End Sub

The output values are:

 0  0
 1  0.302840794569067
 2  0.437277021913479
 3  0.509872642945097
 4  0.54034259603933
 5  0.542722094321379
 6  0.526942370262777
 7  0.499975922872976
 8  0.466668150825204
 9  0.430340568399787
10  0.393227735977447
11  0.356793206695558
12  0.321957511423136
13  0.289262245941889
14  0.258987789726023
15  0.231237419965331
16  0.205997109380684
17  0.183177762994467
18  0.162644802669143
19  0.144238663054396
20  0.127788782952219
21  0.113122963045138
22  0.100073442216316
23  8.84806676326049E-02
24  7.81954599231843E-02
25  6.90800761318472E-02
26  6.10085292017506E-02
27  5.38664186597976E-02
28  4.75504520348827E-02
29  4.19677824506907E-02
30  3.70352490094865E-02
31  0.032678578827157
32  2.88315898343726E-02
33  2.54354194996094E-02
34  2.24377948413794E-02
35  1.97923523053579E-02
36  1.74580114364999E-02
37  0.015398403160248
38  1.35813514548877E-02
39  1.19784059281617E-02
40  1.05644220732389E-02
41  9.31718560734309E-03
42  8.21707717136772E-03
43  7.2467737073169E-03
44  6.39098297257736E-03
45  5.63620785443438E-03
46  4.97053738646888E-03
47  4.38346162038174E-03
48  3.86570776004377E-03
49  3.40909521001796E-03
50  3.00640742404791E-03
51  2.65127865617766E-03
52  2.33809391799585E-03
53  2.06190062835471E-03
54  1.81833060843261E-03
55  1.60353122473657E-03
56  1.41410461754691E-03
57  1.24705407280443E-03
58  1.09973670331187E-03
59  9.69821700788884E-04
60  8.55253506022057E-04
------------------------

This can be compared with the analog simulation.