本文簡要介紹 python 語言中 numpy.sinc
的用法。
用法:
numpy.sinc(x)
返回歸一化的 sinc 函數。
sinc 函數是 。
注意
注意定義中使用的
pi
的歸一化因子。這是信號處理中最常用的定義。使用sinc(x / np.pi)
得到數學中比較常見的非歸一化sinc函數 。- x: ndarray
要計算
sinc(x)
的值的數組(可能是多維的)。
- out: ndarray
sinc(x)
,其形狀與輸入相同。
參數:
返回:
注意:
sinc(0)
是極限值 1。名稱 sinc 是 “sine cardinal” 或 “sinus cardinalis” 的縮寫。
sinc 函數用於各種信號處理應用,包括抗混疊、Lanczos 重采樣濾波器的構造和插值。
對於discrete-time信號的帶限插值,理想的插值內核與sinc函數成正比。
參考:
Weisstein, Eric W. “Sinc 函數”。來自MathWorld-A Wolfram Web 資源。 http://mathworld.wolfram.com/SincFunction.html
維基百科,“Sinc function”,https://en.wikipedia.org/wiki/Sinc_function
1:
2:
例子:
>>> import matplotlib.pyplot as plt >>> x = np.linspace(-4, 4, 41) >>> np.sinc(x) array([-3.89804309e-17, -4.92362781e-02, -8.40918587e-02, # may vary -8.90384387e-02, -5.84680802e-02, 3.89804309e-17, 6.68206631e-02, 1.16434881e-01, 1.26137788e-01, 8.50444803e-02, -3.89804309e-17, -1.03943254e-01, -1.89206682e-01, -2.16236208e-01, -1.55914881e-01, 3.89804309e-17, 2.33872321e-01, 5.04551152e-01, 7.56826729e-01, 9.35489284e-01, 1.00000000e+00, 9.35489284e-01, 7.56826729e-01, 5.04551152e-01, 2.33872321e-01, 3.89804309e-17, -1.55914881e-01, -2.16236208e-01, -1.89206682e-01, -1.03943254e-01, -3.89804309e-17, 8.50444803e-02, 1.26137788e-01, 1.16434881e-01, 6.68206631e-02, 3.89804309e-17, -5.84680802e-02, -8.90384387e-02, -8.40918587e-02, -4.92362781e-02, -3.89804309e-17])
>>> plt.plot(x, np.sinc(x)) [<matplotlib.lines.Line2D object at 0x...>] >>> plt.title("Sinc Function") Text(0.5, 1.0, 'Sinc Function') >>> plt.ylabel("Amplitude") Text(0, 0.5, 'Amplitude') >>> plt.xlabel("X") Text(0.5, 0, 'X') >>> plt.show()
相關用法
- Python numpy sin用法及代碼示例
- Python numpy sinh用法及代碼示例
- Python numpy signbit用法及代碼示例
- Python numpy sign用法及代碼示例
- Python numpy searchsorted用法及代碼示例
- Python numpy shape用法及代碼示例
- Python numpy scimath.log用法及代碼示例
- Python numpy setdiff1d用法及代碼示例
- Python numpy seterr用法及代碼示例
- Python numpy sort用法及代碼示例
- Python numpy scimath.logn用法及代碼示例
- Python numpy square用法及代碼示例
- Python numpy std用法及代碼示例
- Python numpy scimath.log2用法及代碼示例
- Python numpy sum用法及代碼示例
- Python numpy spacing用法及代碼示例
- Python numpy seterrobj用法及代碼示例
- Python numpy squeeze用法及代碼示例
- Python numpy scimath.arccos用法及代碼示例
- Python numpy shares_memory用法及代碼示例
- Python numpy s_用法及代碼示例
- Python numpy swapaxes用法及代碼示例
- Python numpy sctype2char用法及代碼示例
- Python numpy show_config用法及代碼示例
- Python numpy set_printoptions用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.sinc。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。