Sawtooth (FPScript)

21.09.2021

Calculates the sawtooth function with a period of 2π, amplitude of 1 and given width.

Syntax

Sawtooth(Angle [ , Width = 0.5 ])

 

The syntax of the Sawtooth function consists of the following parts:

Part

Description

Angle

The angle in radians for which you want to calculate the sawtooth function.

All data structures are allowed. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Width

A scalar value that specifies the location of the maximum value in the period.

Permitted data structures are scalar value. All numeric data types are permitted.

The value must be greater or equal to 0 and less or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.5.

Remarks

The data type of the result is always 64-bit floating point.

The structure of the result corresponds to that of the argument Angle. The calculation is done element-by-element where appropriate.

The result has the unit 1, if Angle has a unit. Otherwise, it has no unit.

The function first increases linearly from -1 on until it reaches its maximum of 1, where x = 2π * Width. Then it falls linearly and reaches its minimum of -1, where x = 2π. The progression repeats with a period of 2π.

The following illustration shows the course of the function over two periods for different widths:

For aggregate data structures, only the Y component is considered and the X or, if applicable, Z component is copied into the result without modification.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Dim X = Series(0 s, 10 s, 1 ms)
Signal(2 V * Sawtooth(2 Pi * 5 Hz * X, 30 %), X)
 

Generates a sawtooth signal with a sampling rate of 1 kHz in the time range from 0 s to 10 s with an amplitude of 2 V and a frequency of 5 Hz. The maximum is at 30 % of the period.

See Also

Chirp Function

Dirichlet Function

Sin Function

Square Function

Straightline Function

Share article or send as email:

You might be interested in these articles