File:Interpolation constante interpolate interp1d nearest et zero.svg

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

Original file(SVG file, nominally 540 × 360 pixels, file size: 64 KB)

Captions

Captions

Interpolations by constant values.

Summary[edit]

Description
Français : Interpolation avec des valeurs constantes : scipy.interpolate.interp1d() avec les options kind="nearest" et kind="zero".
English: Interpolation with constant values: scipy.interpolate.interp1d() with the options options kind="nearest" and kind="zero".
Date
Source Own work
Author Cdang
 
This plot was created with Matplotlib.
import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt

# *********************************
# * scipy.interpolate.interp1d()  *
# * avec kind="nearest" et "zero" *
# * et extrapolation              *
# *********************************

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

finterpa = interpolate.interp1d(xp, yp, kind="nearest", fill_value="extrapolate")

finterpb = interpolate.interp1d(xp, yp, kind="zero", fill_value="extrapolate")

x = np.linspace(-np.pi, 3*np.pi, 101)
ya = finterpa(x)

yb = finterpb(x)

# *********
# * Tracé *
# *********

fig, liste_axes = plt.subplots(2, 1, constrained_layout=True)

fig.suptitle("Interpolation constante avec interpolate.interp1d()")

liste_axes[0].plot(x, ya, "y")
liste_axes[0].plot(xp, yp, "+r")
liste_axes[0].set_title('kind="nearest"')

liste_axes[1].plot(x, yb, "y")
liste_axes[1].plot(xp, yp, "+r")
liste_axes[1].set_title('kind="zero"')

plt.savefig("interpolation_constante_interpolate_interp1d_nearest_et_zero.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
current19:44, 3 May 2019Thumbnail for version as of 19:44, 3 May 2019540 × 360 (64 KB)Cdang (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata