Urgent but Simple....I think. Aid in manipulating these two code segments.
Posted on 2003-03-25
hi....this first section of code draws a 70mm length of a 8 - 12 Ghz sine wave. The frequency is changed using a scroll bar. I'm not sure how it works...I'm new to programming, but it does what it needs to.
Private Sub DrawWave()
' number of sine waves per box = 70mm/wavelength(mm), ie 2.33 for 10ghz
Dim NumWaves As Single
Dim Wavelength As Double
Dim GHZFreq As Double
Dim x As Single
Dim y As Double
Dim Freq As Single
GHZFreq = scrGunDiode.Value / GHZFactor
Wavelength = 300 / GHZFreq
NumWaves = WIDTHmm / Wavelength
For x = 0 To WIDTHmm Step 0.1
y = Sin(x * NumWaves * (360 / WIDTHmm) * PI / 180) * AMPLITUDE
Me.PicWave.PSet (x, y), vbRed
Me.lblGunDiodeHz = CStr(Val(scrGunDiode.Value / GHZFactor)) & " GHz"
The next section of code is designed to convert the 8 - 12 GHz signal, convert it into the corresponding wavelength. It then changes the original wavelength to the wavelength it changes to when it passes througha waveguide, called ComputeWaveGuideWavelength.
Public Function ComputeWavelength(dblFrequency As Double) As Double
ComputeWavelength = 3 * 10 ^ 8 / dblFrequency
Public Function ComputeWaveGuideWavelength(dblFrequency As Double) As Double
Dim dblOrigWaveLength As Double
dblOrigWaveLength = ComputeWavelength(dblFrequency)
ComputeWaveGuideWavelength = dblOrigWaveLength / Sqr(1 - ((dblOrigWaveLength / 0.04572) ^ 2))
these pieces of code were given to me by two different experts and hence they use different variable names. What I'm trying to do is instead of drawing the original wavelength is to draw the wavelength generated using ComputeWaveGuideWavelength. The second snippet of code is in a code module, not in the form module. How and what would I change to achieve this???