fBasics (version 4032.96)

Heaviside: Heaviside and related functions

Description

Functions which compute the Heaviside and related functions. These include the Heaviside function, the sign function, the delta function, the boxcar function, and the ramp function.

Usage

Heaviside(x, a = 0)
Sign(x, a = 0)
Delta(x, a = 0)
Boxcar(x, a = 0.5)
Ramp(x, a = 0)

Value

numeric vector

Arguments

x

a numeric vector.

a

a numeric value, the location of the break.

Details

Heaviside computes the Heaviside unit step function. Heaviside is 1 for x > a, 1/2 for x = a, and 0 for x < a.

Sign computes the sign function. Sign is 1 for x > a, 0 for x = a, and -1 for x < a.

Delta computes the delta function. Delta is defined as: Delta(x) = d/dx H(x-a).

Boxcar computes the boxcar function. Boxcar is defined as: Boxcar(x) = H(x+a) - H(x-a).

Ramp computes ramp function. The ramp function is defined as: Ramp(x) = (x-a) * H(x-a).

References

Weisstein W. (2004); http://mathworld.wolfram.com/HeavisideStepFunction.html, Mathworld.

See Also

GarchDistribution, GarchDistributionFits

Examples

Run this code
## Heaviside -
   x = sort(round(c(-1, -0.5, 0, 0.5, 1, 5*rnorm(5)), 2))
   h = Heaviside(x)
    
## Sign -
   s = Sign(x)
   
## Delta -
   d = Delta(x)
   
## Boxcar -
   Pi = Boxcar(x)

## Ramp - 
   r = Ramp(x)
   cbind(x = x, Step = h, Signum = s, Delta = d, Pi = Pi, R = r)        

Run the code above in your browser using DataLab