.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_intro_scipy_auto_examples_plot_resample.py: Resample a signal with scipy.signal.resample ============================================= :func:`scipy.signal.resample` uses FFT to resample a 1D signal. Generate a signal with 100 data point .. code-block:: python import numpy as np t = np.linspace(0, 5, 100) x = np.sin(t) Downsample it by a factor of 4 .. code-block:: python from scipy import signal x_resampled = signal.resample(x, 25) Plot .. code-block:: python from matplotlib import pyplot as plt plt.figure(figsize=(5, 4)) plt.plot(t, x, label='Original signal') plt.plot(t[::4], x_resampled, 'ko', label='Resampled signal') plt.legend(loc='best') plt.show() .. image:: /intro/scipy/auto_examples/images/sphx_glr_plot_resample_001.png :class: sphx-glr-single-img **Total running time of the script:** ( 0 minutes 0.019 seconds) .. _sphx_glr_download_intro_scipy_auto_examples_plot_resample.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_resample.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_resample.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_