Main Content

triangle

Triangle wave test signal

Description

triangle(x) generates a triangle wave from the input x based on the equation,

2|2(x12+x)|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 triangle operator in the test step of a Test Sequence or Test Assessment block.

example

Examples

expand all

In a Test Sequence block, Create a triangle wave with a period of 5.

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

The Test Sequence block outputs the triangle 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