In NumPy, the numpy.sinc()
function is used to compute the normalized sinc
function.
Mathematically:
Sinc(x)
=
numpy.sinc(x)
This function takes a single parameter value, x
, which is the input array of values to be calculated.
This function returns an array of the same shape as the input array holding the results for each of the elements.
import numpy as np# creating a evenly spaced numbersx = np.linspace(-2, 2, 20)# implementing the numpy.sinc function element-wisemyarray = np.sinc(x)print(myarray)
numpy
module.x
, containing input values starting from -2
to 2
with an interval of 20
using the linspace()
function.numpy.sinc()
function on the input values. The result is assigned to a variable myarray
.myarray
to the console.