Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Module « scipy.interpolate »

Fonction pchip_interpolate - module scipy.interpolate

Signature de la fonction pchip_interpolate

def pchip_interpolate(xi, yi, x, der=0, axis=0) 

Description

help(scipy.interpolate.pchip_interpolate)

Convenience function for pchip interpolation.

xi and yi are arrays of values used to approximate some function f,
with ``yi = f(xi)``. The interpolant uses monotonic cubic splines
to find the value of new points x and the derivatives there.

See `scipy.interpolate.PchipInterpolator` for details.

Parameters
----------
xi : array_like
    A sorted list of x-coordinates, of length N.
yi : array_like
    A 1-D array of real values. `yi`'s length along the interpolation
    axis must be equal to the length of `xi`. If N-D array, use axis
    parameter to select correct axis.

    .. deprecated:: 1.13.0
        Complex data is deprecated and will raise an error in
        SciPy 1.15.0. If you are trying to use the real components of
        the passed array, use ``np.real`` on `yi`.

x : scalar or array_like
    Of length M.
der : int or list, optional
    Derivatives to extract. The 0th derivative can be included to
    return the function value.
axis : int, optional
    Axis in the yi array corresponding to the x-coordinate values.

Returns
-------
y : scalar or array_like
    The result, of length R or length M or M by R.

See Also
--------
PchipInterpolator : PCHIP 1-D monotonic cubic interpolator.

Examples
--------
We can interpolate 2D observed data using pchip interpolation:

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.interpolate import pchip_interpolate
>>> x_observed = np.linspace(0.0, 10.0, 11)
>>> y_observed = np.sin(x_observed)
>>> x = np.linspace(min(x_observed), max(x_observed), num=100)
>>> y = pchip_interpolate(x_observed, y_observed, x)
>>> plt.plot(x_observed, y_observed, "o", label="observation")
>>> plt.plot(x, y, label="pchip interpolation")
>>> plt.legend()
>>> plt.show()



Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé