Function Math Arithmetic Class

SquareWave

Function whose output resembles a square wave.

Signature (Visual Basic / VBA)

Public Function SquareWave( _
    ByVal vX As Variant _
    ) As Variant

Code Examples

    SquareWave(-2.0) = 1
    SquareWave(-1.5) = 1
    SquareWave(-1.0) = -1
    SquareWave(-0.5) = -1
    SquareWave(+0.0) = 1
    SquareWave(+0.5) = 1
    SquareWave(+1.0) = -1
    SquareWave(+1.5) = -1
    SquareWave(+2.0) = 1
    (-1) ^ Floor(X)

Notes & Version History

vNumber The X position of the square wave whose Y position will be returned. Function returns Null if vNumber is Null or cannot be fixed up to a number.