bundles / scipy latest / scipy / signal / _arraytools / odd_ext
function
scipy.signal._arraytools:odd_ext
source: /scipy/signal/_arraytools.py :57
Signature
def odd_ext ( x , n , axis = -1 ) Summary
Odd extension at the boundaries of an array
Extended Summary
Generate a new ndarray by making an odd extension of x along an axis.
Parameters
x: ndarrayThe array to be extended.
n: intThe number of elements by which to extend
xat each end of the axis.axis: int, optionalThe axis along which to extend
x. Default is -1.
Examples
import numpy as np from scipy.signal._arraytools import odd_ext a = np.array([[1, 2, 3, 4, 5], [0, 1, 4, 9, 16]]) odd_ext(a, 2)✓
t = np.linspace(0, 1.5, 100) a = 0.9 * np.sin(2 * np.pi * t**2) b = odd_ext(a, 40) import matplotlib.pyplot as plt✓
plt.plot(np.arange(-40, 140), b, 'b', lw=1, label='odd extension') plt.plot(np.arange(100), a, 'r', lw=2, label='original') plt.legend(loc='best')✗
plt.show()
✓
Aliases
-
scipy.signal._arraytools.odd_ext