HTBasic Help
×
Menu
Index
Pulse
Generate a pulse waveform.
 
Loading        LOADSUB ALL FROM "PULSE.HTS"
or LOADSUB FROM "MATHLIB.HTS"
or LOADSUB Pulse FROM "MATHLIB.HTS"
 
Usage                REAL P,A,B,S,C,Y(*)
CALL Pulse(P,A,B,S,C,Y(*))
 
Description                
Pulse fills the elements of the array Y with a pulse of duty cycle c, period p, start point s, and high and low values a and b, respectively. P and S are expressed in units of the number of array elements, although they need not be integers. P must be positive and c must be between 0 and 1, inclusive.
 
If Yk refers to an element Yk for a=+1, b=-1, c=0.25, and p=100
 
of array Y, beginning with k = 0, the expression for Yk is:
 
 
In the above expressions, fract(x) is the fractional part of x, calculated by finding the difference between x and the next lower integer from x. Fract(x) is between 0, inclusive, and 1, exclusive.
 
If p or s is contained in a variable of type INTEGER, be sure to use the BASIC REAL command to change the variable to a REAL value when passing it to the Pulse routine.
 
Errors                
Pulse causes an HTBasic error if its arguments are not of the types listed in the USAGE section, above, if p is negative or zero, or if c is not between 0 and 1, inclusive.
 
See Also
Waveform