File:Interpolation lineaire numpy interp trois extrapolations.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 720 × 720 pixels, file size: 53 KB)

Captions

Captions

Three ways to extrapolate with a linear method.

Summary[edit]

Description
Français : Trois manières d'extrapoler avec une méthode linéaire avec Python Numpy :
  • par une valeur constante ;
  • extrapolation périodique ;
  • extrapolation linéaire.
English: Three ways to extrapolate with a linear method with Python Numpy:
  • by a constant value;
  • periodical extrapolation;
  • linear extrapolation.
Date
Source Own work
Author Cdang
 
This plot was created with Matplotlib.
import numpy as np
import matplotlib.pyplot as plt

# **********************
# * numpy.interp()     *
# * sans option period *
# **********************

xp = np.linspace(0, 2*np.pi, 5)
yp = np.sin(xp)

x = np.linspace(-2*np.pi, 4*np.pi, 25)

ya = np.interp(x, xp, yp)

fig, liste_axes = plt.subplots(3, 1, constrained_layout=True, figsize=[8,8])

fig.suptitle("Interpolation linéaire")

liste_axes[0].plot(x, ya, "y-")
liste_axes[0].plot(xp, yp, "r+")
liste_axes[0].set_title("numpy.interp()")

yb = np.interp(x, xp, yp, period=2*np.pi)

liste_axes[1].plot(x, yb, "y-")
liste_axes[1].plot(xp, yp, "r+")
liste_axes[1].set_title("numpy.interp(period=2*np.pi)")

finterp = interpolate.interp1d(xp, yp, kind="slinear", fill_value="extrapolate")

x2 = np.linspace(-np.pi, 3*np.pi, 25)
y2 = finterp(x2)

liste_axes[2].plot(x2, y2, "y")
liste_axes[2].plot(xp, yp, "+r")
liste_axes[2].set_title('scipy.interpolate.interp1d(fill_value="extrapolate")')

plt.savefig("interpolation_lineaire_numpy_interp_trois_extrapolations.svg", format="svg")

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current09:05, 1 May 2019Thumbnail for version as of 09:05, 1 May 2019720 × 720 (53 KB)Cdang (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata