📄 main.frm
字号:
End
Begin VB.PictureBox ipplot
Appearance = 0 'Flat
BackColor = &H00000000&
ForeColor = &H0080FF80&
Height = 2900
Left = 3750
ScaleHeight = 191
ScaleMode = 3 'Pixel
ScaleWidth = 514
TabIndex = 10
Top = 210
Width = 7740
End
Begin VB.Frame Frame3
Caption = "Parameters"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2070
Left = 1845
TabIndex = 5
Top = 315
Width = 1770
Begin VB.TextBox txt_impulsepos
Enabled = 0 'False
Height = 285
Left = 90
TabIndex = 16
Text = "10"
Top = 1665
Width = 870
End
Begin VB.TextBox txtfreq
Height = 300
Left = 90
TabIndex = 9
Text = "10"
Top = 1020
Width = 765
End
Begin VB.TextBox txtsamp
Height = 300
Left = 105
TabIndex = 8
Text = "1000"
Top = 510
Width = 765
End
Begin VB.Label Label3
Caption = "Position"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 60
TabIndex = 17
Top = 1365
Width = 1575
End
Begin VB.Label Label2
Caption = "Frequency(Hz)"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 90
TabIndex = 7
Top = 795
Width = 1575
End
Begin VB.Label Label1
Caption = "Sampling Rate"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 75
TabIndex = 6
Top = 270
Width = 1635
End
End
Begin VB.Frame Frame2
Caption = "Wave"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2070
Left = 120
TabIndex = 1
Top = 315
Width = 1665
Begin VB.OptionButton opt_impulse
Caption = "Impulse"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 61
TabIndex = 15
Top = 1740
Width = 1230
End
Begin VB.OptionButton Opt_sqr
Caption = "Square"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 61
TabIndex = 4
Top = 1260
Width = 1170
End
Begin VB.OptionButton opt_cos
Caption = "Cos"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 61
TabIndex = 3
Top = 810
Width = 1080
End
Begin VB.OptionButton opt_sin
Caption = "Sin"
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 61
TabIndex = 2
Top = 300
Value = -1 'True
Width = 1110
End
End
End
End
Attribute VB_Name = "mainfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim REX(256) 'REX[ ] holds the real part of the frequency domain
Dim IMX(256) 'IMX[ ] holds the imaginary part of the frequency domain
Private Sub btn_clr_Click()
ipplot.Cls
FuncGen.Clear
End Sub
Private Sub btn_generate_Click()
FuncGen.SamplingRate = CInt(txtsamp.Text)
FuncGen.amplitude = Slideramp.Value
If opt_sin.Value = True Then
FuncGen.GenSine CInt(txtfreq.Text)
End If
If opt_cos.Value = True Then
FuncGen.GenCos CInt(txtfreq.Text)
End If
If opt_impulse.Value = True Then
FuncGen.GenImpulse Val(txt_impulsepos.Text)
End If
If Opt_sqr.Value = True Then
FuncGen.GenSquare CInt(txtfreq.Text)
End If
ipplot.Cls
plotip
End Sub
Private Sub Command1_Click()
output.Cls
End Sub
Private Sub Command2_Click()
If Optreal.Value = True Then
output.ForeColor = vbRed
For cnt = 0 To 156
outputarray(cnt) = REX(cnt)
Next cnt
End If
If Optimg.Value = True Then
output.ForeColor = vbWhite
For cnt = 0 To 156
outputarray(cnt) = IMX(cnt)
Next cnt
End If
If Optmag.Value = True Then
output.ForeColor = vbYellow
For cnt = 0 To 156
outputarray(cnt) = Sqr((IMX(cnt) * IMX(cnt)) + (REX(cnt) * REX(cnt)))
Next cnt
End If
If Optphase.Value = True Then
output.ForeColor = vbCyan
For cnt = 0 To 156
outputarray(cnt) = Atn(IMX(cnt) / REX(cnt))
Next cnt
End If
If Optpower.Value = True Then
output.ForeColor = vbGreen
For cnt = 0 To 156
outputarray(cnt) = Sqr((IMX(cnt) * IMX(cnt)) + (REX(cnt) * REX(cnt)))
Next cnt
End If
For cnt = 0 To 256
If (maxvalue < outputarray(cnt)) Then
maxvalue = outputarray(cnt)
End If
Next cnt
oldval = (2600 / (2 * Screen.TwipsPerPixelY)) - (outputarray(1) * ((950 / Screen.TwipsPerPixelY) / maxvalue))
For cnt = 1 To 256
output.Line (cnt - 1, oldval)-(cnt, (2600 / (2 * Screen.TwipsPerPixelY)) - (outputarray(cnt) * ((950 / Screen.TwipsPerPixelY) / maxvalue)))
oldval = (2600 / (2 * Screen.TwipsPerPixelY)) - (outputarray(cnt) * ((950 / Screen.TwipsPerPixelY) / maxvalue))
Next cnt
End Sub
Private Sub Command3_Click()
MsgBox "Developed and published by : " + vbNewLine + "LOGIX4U" + vbNewLine + "www.logix4u.net" + vbNewLine + vbNewLine + "Algorithms by : " + vbNewLine + "Steven W Smith " + vbNewLine + "www.dspguide.com", vbInformation, "About"
End Sub
Private Sub Command4_Click()
On Error Resume Next
Label5.Visible = True
DoEvents
If Opthamm.Value = True Then
FuncGen.ApplyHamming
ipplot.Cls
plotip
End If
If Opthann.Value = True Then
FuncGen.ApplyHanning
ipplot.Cls
plotip
End If
If Optblack.Value = True Then
FuncGen.ApplyBlackman
ipplot.Cls
plotip
End If
100 'THE DISCRETE FOURIER TRANSFORM
'copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -