Main Content

square

Square wave test signal

Syntax

Description

square(x) creates a square wave with a period of 1 and range -1 to 1. In the interval 0 <= x < 1, square(x) returns 1 for 0 <= x < 0.5 and -1 for 0.5 <= x < 1.

To specify the number of square wave cycles within a test step, use this operator with the elapsed time (et) operator.

Examples

Create a Square Wave

Create a square wave with a period of 10.

square(et/10)

Tips

square signal generation statements can be used in the Test Sequence and Test Assessment blocks and in Stateflow® charts.

Introduced in R2015a