相关代码 |
|
Sub CORREL(DATA1(), DATA2(), N, ANS()) Dim FFT(128) Call TWOFFT(DATA1(), DATA2(), FFT(), ANS(), N) NO2 = N / 2# For I = 1 To NO2 + 1 DUM = ANS(2 * I - 1) DUM1 = FFT(2 * I - 1) * DUM + FFT(2 * I) * ANS(2 * I) ANS(2 * I - 1) = DUM1 / CSng(NO2) DUM2 = FFT(2 * I) * DUM - FFT(2 * I - 1) * ANS(2 * I) ANS(2 * I) = DUM2 / CSng(NO2) Next I ANS(2) = ANS(N + 1) Call REALFT(ANS(), NO2, -1) Erase FFT End Sub