Main Content

square

Square wave test signal

Description

example

y = square(x) generates a square wave from the input x based on the equation,

2(2x2x)+1,

where the L-brackets represent the floor of the contents. The output wave has a range from -1 to 1. Use the et operator as the input to generate the wave throughout simulation time in the test step. Divide et by a value to specify a period. Use the square operator in the test step of a Test Sequence or Test Assessment block.

Examples

expand all

In a Test Sequence block, create a square wave with a period of 5.

A test step that outputs a square wave signal with a period of 5 seconds while active.

The Test Sequence block outputs the square wave:

The output of the Test Sequence block, shown in a Scope block.

Input Arguments

expand all

Value during the test step, specified as a numeric scalar.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Version History

Introduced in R2015a