基于VB 的频谱分析仪 些许问题
我想请问 :基于VB 的频谱分析仪
需要实现的是从串口实现数据的采集 ,后存入数组中 ,然后进行FFT 的变化,把变换的图形在界面上显示出来,结果图形 必须在有坐标轴的界面上。
这个是一个FFT的模块程序。现在需要自己定义一个函数 ,存入数组中(类似于方波 (0,0,0,1,1,1,0,0,0)),来检验FFT模块 是否正确 。该如何下手 。
Private Sub CommandFFT_Click()
N=256
R=8
Dim TR (0 To 256) As Single, TI (0 To 256) As Single,R2 (0 To 256) As Single
Dim TR1, A As Single, K,Q,L As Integer
Dim TI1, A1,A2 As Single
For K= 0 To N
TR(K) = e (K)
TI(K) = 0
'Print " "; TR(K),TI(K)
Next K
85 For L = 1 To R
N1= 2^(R-L)
P = 0
540 G = P
GoSub 1000
A = 2*3.1415926*D/N
A1 = Cos(A)
A2 = Sin(A)
For K = P* N1 To (P+1) *N1 -1
TR1 = TR(K+N1) *A1 +TI(K+N1) *A2
TI1 = TI(K+N1) *A1 - TR(K+N1) *A2
TR(K+N1) = TR(K) - TR1
TI(K+N1) = TI(K) - TI1
TR(K) = TR(K) +TR1
TI(K) = TI(K) +TI1
Next K
P = P+2
If (P+1) * N1 < N Then Go To 540
Next L
For K = 0 To N-1
G = K
GoSub 1000
If K >= D Then Go To 800
TR1 = TR(K)
TI1 = TI(K)
TR(K) =TR(D)
TI(K) =TI(D)
TR(D) = TR1
TI(D) = TI1
800 Next K
Cls
Scale (0,64)-(128,-64)
DrawWidth = 1
Line (0,0)-(128,0), RGB(0,0,255)
Line (0,64)-(0,-64), RGB(0,0,255)
For K =0 To N-1
R2(K) = Sqr(TR(K) * TR(K) + TI(K)* TI(K))
820 'Print K; Tab(8); TR(K);Tab(24);TI(K);Tab(50);R2(K)
DrawWidth = 1
PSet (K,R2(K)), RGB(255,0,0)
Line (K,R2(K))-(K,0), RGB(255,0,255)
Next K
Go To 86
1000 D = 0
For Q = 1 To R
C = Int(G / 2)
D = 2*D+G-2* C
G = C
Next Q
Return\
86 End Sub
请高手专家帮帮忙啊 ·· --------------------编程问答--------------------
补充:VB , 网络编程