View previous topic :: View next topic 
Author 
Message 
JayPro
Joined: 01 May 2004 Posts: 726 Location: Huntington Station, Long Island, New York

Posted: Fri Oct 05, 2018 8:44 pm Post subject: Function Question: (sqwv) 


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. _________________ "Some people look at things as they are and ask why. I look at things that never have been and ask why not." 

Back to top 


jerohm Senior Member
Joined: 09 Jan 2009 Posts: 398

Posted: Sat Oct 06, 2018 6:35 am Post subject: 


Code:  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*s1)*2" // [2 ... 2], inclusive
X0="A0"
Y0="sqwv(A0)/2" // divided by 2 so it is visible in frame
Vers=500

Code:  Aspc=1
ConB=1
// REAL(static) square wave
A0="(2*s1)" // [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:  Aspc=1
ConB=1
// REAL(moving) square wave
A0="(2*s1)" // [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

are we good?? 

Back to top 


ShohS
Joined: 06 Apr 2018 Posts: 40 Location: no one must know shhhh

Posted: Tue Oct 09, 2018 8:21 am Post subject: 


I think its a square wave that doesn't loop _________________ Nut 

Back to top 


DanPin
Joined: 15 Mar 2016 Posts: 161 Location: Los Angeles County, California

Posted: Wed Oct 10, 2018 7:08 pm Post subject: 


ShohS wrote:  I think its a square wave that doesn't loop 
Well, you're absolutely right. The abbreviation 'sqwv' can mean 'square wave'. In the Documentation, under Config Programming  Logic/Discrete it technically explains "returns 1 if x <= 1.0 and 0 otherwise". This should make sense to you. 

Back to top 


