What does this function do exactly??
Since I suck at mathematics in general, I could use some help extrapolating the subjectively perceived gibberish required to explain the concept to what I can actually see it doing.
Thanks.
			
			
									
									Function Question: (sqwv)
Moderators: BTT, andy55, b.dwall, juxtiphi
- JayPro
 - Posts: 738
 - Joined: Sat May 01, 2004 10:51 pm
 - Location: Huntington Station, Long Island, New York
 
Function Question: (sqwv)
"God is syntax."
						Code: Select all
Aspc=1             // so it is visible in frame
ConB=1
// sqwv(x) :
// return 1 if abs(X) <= 1.0, otherwise 0
//  or MORE ACCURATELY a square PULSE [-1 ... 1]
A0="(2*s-1)*2"         // [-2 ... 2], inclusive
X0="A0"
Y0="sqwv(A0)/2"       // divided by 2 so it is visible in frame
Vers=500
Code: Select all
Aspc=1
ConB=1
// REAL(static) square wave
A0="(2*s-1)"    // [-1 ... 1], inclusive
A1=10	        // Pulse Count
A2="A0*Pi * A1" // Cycles
X0="A0"
Y0="(pos(sign(sin(A2))) -.5)/A1"	// centered about Y axis
Vers=500
Code: Select all
Aspc=1
ConB=1
// REAL(moving) square wave
A0="(2*s-1)"    // [-1 ... 1], inclusive
A1=2 	        // Pulse Count
A2="A0*Pi * A1" // Cycles
X0="A0"
Y0="(pos(sign(sin(A2 - A1*t))) -.5)/A1"	// centered about Y axis
Vers=500