vb.netfft代码 vbnet wcf( 四 )


min-max标准化(Min-Max Normalization)
也称为离差标准化,是对原始数据的线性变换 , 使结果值映射到[0 , 1]之间 。转换函数如下:
其中max为样本数据的最大值,min为样本数据的最小值 。这种方法有个缺陷就是当有新数据加入时 , 可能导致max和min的变化 , 需要重新定义 。
求VB的FFT和FFT的反变换代码晕 还有找快速傅立叶变换的
这个哥们博客有很多相关的
这个好像可以进行FFT和IFFT
前几天刚考完数字信号处理 学的这个晕啊
呵呵
这个是FFT的
*模块********************************************************
'FFT0 数组下标以0开始 FFT1 数组下标以1开始
'AR() 数据实部AI() 数据虚部
'N 数据点数,为2的整数次幂
'NI 变换方向 1为正变换,-1为反变换
'***************************************************************
Public Const Pi = 3.1415926
Public Function FFT0(AR() As Double, AI() As Double, N As Integer, ni As Integer)
Dim i As Integer, j As Integer, k As Integer, L As Integer, M As Integer
Dim IP As Integer, LE As Integer
Dim L1 As Integer, N1 As Integer, N2 As Integer
Dim SN As Double, TR As Double, TI As Double, WR As Double, WI As Double
Dim UR As Double, UI As Double, US As Double
M = NTOM(N)
N2 = N / 2
N1 = N - 1
SN = ni
j = 1
For i = 1 To N1
If ij Then
TR = AR(j - 1)
AR(j - 1) = AR(i - 1)
AR(i - 1) = TR
TI = AI(j - 1)
AI(j - 1) = AI(i - 1)
AI(i - 1) = TI
End If
k = N2
While (kj)
j = j - k
k = k / 2
Wend
j = j + k
Next i
For L = 1 To M
LE = 2 ^ L
L1 = LE / 2
UR = 1#
UI = 0#
WR = Cos(Pi / L1)
WI = SN * Sin(Pi / L1)
For j = 1 To L1
For i = j To N Step LE
IP = i + L1
TR = AR(IP - 1) * UR - AI(IP - 1) * UI
TI = AI(IP - 1) * UR + AR(IP - 1) * UI
AR(IP - 1) = AR(i - 1) - TR
AI(IP - 1) = AI(i - 1) - TI
AR(i - 1) = AR(i - 1) + TR
AI(i - 1) = AI(i - 1) + TI
Next i
US = UR
UR = US * WR - UI * WI
UI = UI * WR + US * WI
Next j
Next L
If SN-1 Then
For i = 1 To N
AR(i - 1) = AR(i - 1) / N
AI(i - 1) = AI(i - 1) / N
Next i
End If
End Function
Public Function FFT1(AR() As Double, AI() As Double, N As Integer, ni As Integer)
Dim i As Integer, j As Integer, k As Integer, L As Integer, M As Integer
Dim IP As Integer, LE As Integer
Dim L1 As Integer, N1 As Integer, N2 As Integer
Dim SN As Double, TR As Double, TI As Double, WR As Double, WI As Double
Dim UR As Double, UI As Double, US As Double
M = NTOM(N)
N2 = N / 2
N1 = N - 1
SN = ni
j = 1
For i = 1 To N1
If ij Then
TR = AR(j)
AR(j) = AR(i)
AR(i) = TR
TI = AI(j)
AI(j) = AI(i)
AI(i) = TI
End If
k = N2
While (kj)
j = j - k
k = k / 2
Wend
j = j + k
Next i
For L = 1 To M
LE = 2 ^ L
L1 = LE / 2
UR = 1#
UI = 0#
WR = Cos(Pi / L1)
WI = SN * Sin(Pi / L1)
For j = 1 To L1
For i = j To N Step LE
IP = i + L1
TR = AR(IP) * UR - AI(IP) * UI
TI = AI(IP) * UR + AR(IP) * UI
AR(IP) = AR(i) - TR
AI(IP) = AI(i) - TI
AR(i) = AR(i) + TR
AI(i) = AI(i) + TI
Next i
US = UR
UR = US * WR - UI * WI
UI = UI * WR + US * WI
Next j
Next L
If SN-1 Then
For i = 1 To N
AR(i) = AR(i) / N
AI(i) = AI(i) / N
Next i
End If
End Function
Private Function NTOM(N As Integer) As Integer
Dim ND As Double
ND = N
NTOM = 0
While (ND1)

推荐阅读