Learn R Programming

phonTools (version 0.1-6)

sinc: Sinc Function

Description

Sample the sinc function at gvien points

Usage

sinc (x, normalized = FALSE)

Arguments

x
A vector of points at which the sinc function will be calculated.
normalized
If TRUE, a normalized sinc function is returned.

Value

  • A vector containing y-axis values for each specified x-axis value is returned.

Details

The formula for the unnormalized sinc function is y = sin(x)/x. The formula for the normalized sinc function is y = sin(x*pi)/(x*pi).

References

http://en.wikipedia.org/wiki/Sinc_function Lyons, R. G. (2004). Understanding Digital Signal Processing (2nd ed.). Prentice Hall.

Examples

Run this code
x = seq(-20,20,.1)
## generate both forms of the sinc function between -20 and 20
y1 = sinc (x)
y2 = sinc (x, normalized = TRUE)
## the unnormalized sinc function has zero crossing at integer multiples of pi
plot (x,y1, type = 'b')
## the normalized sinc function has zero crossing at integers
lines (x,y2, type = 'b', col = 4)
abline (h = 0)

Run the code above in your browser using DataLab