Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

extrapolate python

import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline

# given values
xi = np.array([0.2, 0.5, 0.7, 0.9])
yi = np.array([0.3, -0.1, 0.2, 0.1])
# positions to inter/extrapolate
x = np.linspace(0, 1, 50)
# spline order: 1 linear, 2 quadratic, 3 cubic ... 
order = 1
# do inter/extrapolation
s = InterpolatedUnivariateSpline(xi, yi, k=order)
y = s(x)

# example showing the interpolation for linear, quadratic and cubic interpolation
plt.figure()
plt.plot(xi, yi)
for order in range(1, 4):
    s = InterpolatedUnivariateSpline(xi, yi, k=order)
    y = s(x)
    plt.plot(x, y)
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: pltoly boxlpot 
Python :: micropython string to int 
Python :: does building wheel for dlib setup py takes forever 
Python :: autoencoder for classification keras 
Python :: sidetable github 
Python :: django phone number 
Python :: flask return 404 
Python :: plot idl 
Python :: Return an RDD created by coalescing all elements within each partition into a list. 
Python :: importare un csv in pycharm e pandas 
Python :: Gets an existing SparkSession or, if there is no existing one, creates a new one based on the options set in this builder 
Python :: 5.4.7 categories python 
Python :: how to xor two element in python 
Python :: sqlite3 with flask web application CRUD pdf 
Python :: come traferire file python 
Python :: how to use Py-agender for projects 
Python :: python sort list of tuples lexicographically 
Python :: how to have framer read json timestamps 
Python :: unittest sleep 
Python :: django clear _pycache_ command 
Python :: quadre 
Python :: how to delete a cell in jupyter notebook 
Python :: knox token lifetime 
Python :: pandas terms for list of substring present in another list python 
Python :: how can I get response from amazon with beautiful soap if I get 503? 
Python :: flask admin forgeign keys show literal 
Python :: python intitialize a 2d matrix 
Python :: gravar arquivo python 
Python :: The Bytearray Type 
Python :: python map function using lambda function as one of the parameters 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =