diric {gsignal}R Documentation

Dirichlet function

Description

Compute the Dirichlet or periodic sinc function.

Usage

diric(x, n)

Arguments

x

Input array, specified as a real scalar, vector, matrix, or multidimensional array. When x is non-scalar, diric is an element-wise operation.

n

Function degree, specified as a positive integer scalar.

Details

y <- diric(x, n) returns the Dirichlet Function of degree n evaluated at the elements of the input array x.

The Dirichlet function, or periodic sinc function, has period 2π2 \pi for odd NN and period 4π4 \pi for even NN. Its maximum value is 1 for all N, and its minimum value is -1 for even N. The magnitude of the function is 1 / N times the magnitude of the discrete-time Fourier transform of the N-point rectangular window.

Value

Output array, returned as a real-valued scalar, vector, matrix, or multidimensional array of the same size as x.

Author(s)

Sylvain Pelissier, sylvain.pelissier@gmail.com.
Conversion to R by Geert van Boxtel G.J.M.vanBoxtel@gmail.com.

Examples


## Compute and plot the Dirichlet function between -2pi and 2pi for N = 7
## and N = 8. The function has a period of 2pi for odd N and 4pi for even N.
x <- seq(-2*pi, 2*pi, len = 301)
d7 <- diric(x, 7)
d8 <- diric(x, 8)
op <- par(mfrow = c(2,1))
plot(x/pi, d7, type="l", main = "Dirichlet function",
     xlab = "", ylab = "N = 7")
plot(x/pi, d8, type="l", ylab = "N = 8", xlab = expression(x / pi))
par(op)


[Package gsignal version 0.3-5 Index]