**SQUAREWAVE**

SQUAREWAVE(Time, Period, Value1, Value2, DutyCycle) provides a square wave function.

Time is the value of time (sec or hours)

Period is the period of the square wave (sec or hours), i.e., the time required for one complete cycle including the both sections.

Value1 is the value returned by the function if (Time-(trunc(TIme/Period)*Period)<=Period*DutyCycle

Value2 is the value returned by the function if (Time-(trunc(TIme/Period)*Period)>Period*DutyCycle

Value1 and Value2 should have the same dimensions and units. The value returned by the function will have the same dimensions and units as Value1,

DutyCycle is an optional parameter that must range between 0.01 and 0.99. If it is not provided, the value of DutyCycle is set to 0.5.

**Example 1:**

V1=0.9 [m]

V2=0.1 [m]

Period=0.25 [s]

Time=2.1 [s]

x=**squarewave**(Time,Period,V1,V2)

{**Solution**

x=0.9 [m]}

**Example 2:**

{Create a Parametric Table with x and time having 1000 rows. Fix time with incremented values between 0 and 1. Plot the results}

V1=0.9 [m]

V2=0.1 [m]

Period=0.25 [s]

DutyCycle=0.2

x=**squarewave**(Time,Period,V1,V2,DutyCycle)