News:

Function Finder  Find all the functions within source code files

Main Menu

Frequency

Started by kevin, November 21, 2023, 07:51:47 PM

Previous topic - Next topic

kevin

Frequency by Scotty Bro


PlayBASIC Code: [Select]
; PROJECT : Frequency
; AUTHOR : Scott_Bro_1
; CREATED : 12/2/2020
; EDITED : 12/3/2020
; ---------------------------------------------------------------------





Amplitude = 200


// Radians To Degrees = Radians * 180 / 3.14
// Degrees To Radians = DEgrees * 3.14 / 180

// Radians: 0 - 6.28
// Degrees: 0 - 360

Dim Way_Points(600)

X_Inc# = 6.28 / 600

For L = 0 To 600 Step 1

Degrees# = X# * 180 / PI#

// One cycle per second.

Sine_Wave_1# = Sin(Degrees#) * Amplitude

// Double frequency half amplitude.

Sine_Wave_2# = Sin(Degrees# * 2) * Amplitude / 2

// Combination and scaled to original amplitude.

Sine_Wave_3# = Sin(Degrees#) * Amplitude / 2 + Sin(Degrees# * 2) * Amplitude / 4

Way_Points(L) = Sine_Wave_3#

Ink RGB(255,0,0)

Dot 400 + Sine_Wave_1#,Y

Ink RGB(0,255,0)

Dot 400 + Sine_Wave_2#,Y

Ink RGB(0,0,255)

Dot 400 + Sine_Wave_3#,Y

// Radians!

//X# = X# + X_Inc#

X# = X_Inc# * L

//Y = Y + 1

Y = L

Next L

Sync

Waitkey

End