r""" Return the normalized sinc function. The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not only everywhere continuous but also infinitely differentiable. .. note:: Note t
(x)
| 3741 | |
| 3742 | @array_function_dispatch(_sinc_dispatcher) |
| 3743 | def sinc(x): |
| 3744 | r""" |
| 3745 | Return the normalized sinc function. |
| 3746 | |
| 3747 | The sinc function is equal to :math:`\sin(\pi x)/(\pi x)` for any argument |
| 3748 | :math:`x\ne 0`. ``sinc(0)`` takes the limit value 1, making ``sinc`` not |
| 3749 | only everywhere continuous but also infinitely differentiable. |
| 3750 | |
| 3751 | .. note:: |
| 3752 | |
| 3753 | Note the normalization factor of ``pi`` used in the definition. |
| 3754 | This is the most commonly used definition in signal processing. |
| 3755 | Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function |
| 3756 | :math:`\sin(x)/x` that is more common in mathematics. |
| 3757 | |
| 3758 | Parameters |
| 3759 | ---------- |
| 3760 | x : ndarray |
| 3761 | Array (possibly multi-dimensional) of values for which to calculate |
| 3762 | ``sinc(x)``. |
| 3763 | |
| 3764 | Returns |
| 3765 | ------- |
| 3766 | out : ndarray |
| 3767 | ``sinc(x)``, which has the same shape as the input. |
| 3768 | |
| 3769 | Notes |
| 3770 | ----- |
| 3771 | The name sinc is short for "sine cardinal" or "sinus cardinalis". |
| 3772 | |
| 3773 | The sinc function is used in various signal processing applications, |
| 3774 | including in anti-aliasing, in the construction of a Lanczos resampling |
| 3775 | filter, and in interpolation. |
| 3776 | |
| 3777 | For bandlimited interpolation of discrete-time signals, the ideal |
| 3778 | interpolation kernel is proportional to the sinc function. |
| 3779 | |
| 3780 | References |
| 3781 | ---------- |
| 3782 | .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web |
| 3783 | Resource. https://mathworld.wolfram.com/SincFunction.html |
| 3784 | .. [2] Wikipedia, "Sinc function", |
| 3785 | https://en.wikipedia.org/wiki/Sinc_function |
| 3786 | |
| 3787 | Examples |
| 3788 | -------- |
| 3789 | >>> import numpy as np |
| 3790 | >>> import matplotlib.pyplot as plt |
| 3791 | >>> x = np.linspace(-4, 4, 41) |
| 3792 | >>> np.sinc(x) |
| 3793 | array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary |
| 3794 | -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, |
| 3795 | 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, |
| 3796 | 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, |
| 3797 | -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, |
| 3798 | 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, |
| 3799 | 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, |
| 3800 | 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, |
searching dependent graphs…