Private Sub Command1_Click()
'PROGRAM D12R3
'Driver for routine REALFT
EPS = 0.001
NP = 32
NPP2 = NP + 2
Width1 = 50#
PI = 3.14159
Dim DATA(34), SIZE1(32)
N = NP / 2
Print Tab(5); "Period of sinusoid in channels (2-";
Print Format$(NP, "##"); "; or 0 to stop)"
PER = 5
If PER For I = 1 To NP
DATA(I) = Cos(2# * PI * (I - 1) / PER)
Next I
Call REALFT(DATA(), N, 1)
BIG = -10000000000#
For I = 1 To N
SIZE1(I) = Sqr(DATA(2 * I - 1) ^ 2 + DATA(2 * I) ^ 2)
If I = 1 Then SIZE1(I) = DATA(I)
If SIZE1(I) > BIG Then BIG = SIZE1(I)
Next I
SCAL1 = Width1 / BIG
For I = 1 To N
NLIM = SCAL1 * SIZE1(I) + EPS
Form1.Print Tab(5); Format$(I, "##");
For J = 1 To NLIM + 1
Print "*";
Next J
Next I
Call REALFT(DATA(), N, -1)
BIG = -10000000000#
SMALL = 10000000000#
For I = 1 To NP
If DATA(I) < SMALL Then SMALL = DATA(I)
If DATA(I) > BIG Then BIG = DATA(I)
Next I
SCAL1 = Width1 / (BIG - SMALL)
For I = 1 To NP
NLIM = Int(SCAL1 * (DATA(I) - SMALL) + EPS)
Print Tab(5); Format$(I, "##");
For J = 1 To NLIM + 1
Print "*";
Next J
Next I
End Sub