成都创新互联网站制作重庆分公司

vb.netfft函数 vbformat函数

VB.NET自定义函数

很简单,在end select前再多加一种情况case else return "XXXx",因为你只提供了0-9这10种情况

坚守“ 做人真诚 · 做事靠谱 · 口碑至上 · 高效敬业 ”的价值观,专业网站建设服务10余年为成都iso认证小微创业公司专业提供企业网站建设营销网站建设商城网站建设手机网站建设小程序网站建设网站改版,从内容策划、视觉设计、底层架构、网页布局、功能开发迭代于一体的高端网站建设服务。

Public Function Zuhe(ByVal qa As String) As String

Select Case qa

Case "0"

Return "1"

Case "1"

Return "3"

Case "2"

Return "4"

Case "3"

Return "6"

Case "4"

Return "2"

Case "5"

Return "8"

Case "6"

Return "9"

Case "7"

Return "7"

Case "8"

Return "5"

Case "9"

Return "0"

Case else

Return "XXXX"

End Select

End Function

一组数据,用vb求fft,数据需要归一化吗

一组数据,用vb求fft,数据需要归一化。

归一化后求FFT和没有归一化的值幅值相差一个倍数,各次谐波的角度不变。这个倍数就是归一化的过程缩小的倍数。

FFT是快速傅立叶分解,FFT后出来的数据不是点,第一个结果是直流分量,其模需要除以采样点数,才能是幅值。如果是150点,出来的150个数据是0,1,2,.....75,74,73.....2,1。所以直流量没有对称数据。

数据标准化(归一化)处理是数据挖掘的一项基础工作,不同评价指标往往具有不同的量纲和量纲单位,这样的情况会影响到数据分析的结果,为了消除指标之间的量纲影响,需要进行数据标准化处理,以解决数据指标之间的可比性。原始数据经过数据标准化处理后,各指标处于同一数量级,适合进行综合对比评价。以下是常用的归一化方法:

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 i j 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 (k j)

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 i j 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 (k j)

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 (ND 1)

ND = ND / 2

NTOM = NTOM + 1

Wend

End Function

'*使用**********

Const fftIn = 128

Dim i As Integer

Dim xr(128) As Double

Dim xi(128) As Double

'赋值,IaIn(i)是采得的数据。

For i = 0 To 128

xr(i) = 100 * IaIn(i)

xi(i) = 0

Next

'FFT变换

Call FFT0(xr(), xi(), 128, 1)

'绘图

picI_FFT.Scale (0, 100)-(fftIn - 1, -10)

picI_FFT.DrawWidth = 2

For i = 0 To fftIn - 1

picI_FFT.Line (i, Abs(xr(i)))-(i + 1, Abs(xr(i + 1))), vbBlue

Next i


网页名称:vb.netfft函数 vbformat函数
本文地址:http://cxhlcq.com/article/doohjej.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部