Learn R Programming

rdetools (version 1.0)

sincdata: Generate random sinc data

Description

Function draws n points uniformly from the interval $[a, b]$, calculates the sinc (normalized sinc function) values for that points and adds a normal noise with a standard deviation of noise to these values.

Usage

sincdata(n, noise = 0, a = -4, b = 4)

Arguments

n
number of points to generate
noise
noise level to add to sinc values, i.e. standard deviation of normal noise
a
left bound of interval from which the xs are drawn, a must be smaller than b
b
right bound of interval from which the ys are drawn, b must be larger than a

Value

Randomly generated sinc data
X
matrix with one column (i.e. a vector, but returned object is a matrix) containing the x-values
y
matrix with one row (i.e. a vector, but returned object is a matrix) containing the y-values

References

http://en.wikipedia.org/wiki/Sinc\_function

See Also

sinc

Examples

Run this code
## generate 100 data points with noise level 0
## drawn from the interval [-4,4]
sincdata(100)

## generate 1000 data points with noise level 0.7
## drawn from the interval [-10, 10]
sincdata(100, 0.7, a = -10, b = 10)

Run the code above in your browser using DataLab