Quantcast

Documentation Center

  • Trial Software
  • Product Updates

triangularPulse

Triangular pulse function

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

triangularPulse(a, b, c, x)
triangularPulse(a, c, x)

Description

triangularPulse(a, b, c, x) represents the triangular function.

triangularPulse(a, c, x) is a shortcut for triangularPulse(a, (a + c)/2, c, x).

triangularPulse(x) is a shortcut for triangularPulse(-1, 0, 1, x).

triangularPulse represents the triangular pulse function. This function is also called the triangle function, hat function, tent function, or sawtooth function.

If a, b, and c are variables or expressions with variables, triangularPulse assumes that a <= b <= c. If a, b, and c are numerical values that do not satisfy this condition, triangularPulse throws an error.

If a < x < b, the triangular function equals (x - a)/(b - a). If b < x < c, the triangular function equals (c - x)/(c - b). Otherwise, it equals 0. See Example 1 and Example 2.

If a = b or b = c, the triangular function can be expressed in terms of the rectangular function. See Example 3.

If a = b = c, triangularPulse returns 0. See Example 4.

triangularPulse(x) is equivalent to triangularPulse(-1, 0, 1, x). See Example 5.

triangularPulse(a, c, x) is equivalent to triangularPulse(a, (a + c)/2, c, x). See Example 6.

triangularPulse also accepts infinities as its arguments. See Example 9.

triangularPulse and tripulse are equivalent.

Examples

Example 1

Compute the triangular pulse function for these input arguments:

[triangularPulse(-2, 0, 2, -3), triangularPulse(-2, 0, 2, -1/2),
triangularPulse(-2, 0, 2, 0), triangularPulse(-2, 0, 2, 3/2),
triangularPulse(-2, 0, 2, 3)]

Example 2

Compute the triangular pulse function for a < x < b:

triangularPulse(a, b, c, x) assuming a < x < b

Compute the triangular pulse function for b < x < c:

triangularPulse(a, b, c, x) assuming b < x < c

Example 3

Compute the triangular pulse function for a = b and c = b:

triangularPulse(b, b, c, x) assuming b < c

triangularPulse(a, b, b, x) assuming a < b

Example 4

For a = b = c, the triangular pulse function returns 0:

triangularPulse(a, a, a, x)

Example 5

Use triangularPulse with one input argument as a shortcut for computing triangularPulse(-1, 0, 1, x):

triangularPulse(x)

[triangularPulse(-10), triangularPulse(-3/4), triangularPulse(0),
triangularPulse(2/3), triangularPulse(1)]

Example 6

Use triangularPulse with three input arguments as a shortcut for computing triangularPulse(a, (a + c)/2, c, x):

triangularPulse(a, c, x)

[triangularPulse(-10, 10, 3), triangularPulse(-1/2, -1/4, -2/3), triangularPulse(2, 4, 3),
triangularPulse(2, 4, 6), triangularPulse(-1, 4, 0)]

Example 7

Rewrite the triangular pulse function in terms of the Heaviside step function:

rewrite(triangularPulse(a, b, c, x), heaviside)

Example 8

Plot the triangular pulse function:

plot(triangularPulse(x), x = -2..2)

Example 9

Plot the triangular pulse function for which the argument c is a positive infinity:

plot(triangularPulse(-1, 1, infinity, x))

Parameters

a, b, c, x

Arithmetical expressions.

Return Values

Arithmetical expression.

Overloaded By

x

See Also

MuPAD Functions

Was this topic helpful?