当前位置:   article > 正文

三次样条插值(Python实现)_python三次样条插值

python三次样条插值

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

from scipy import interpolate

import matplotlib as mpl

mpl.rcParams[“font.sans-serif”] = [“SimHei”]

mpl.rcParams[“axes.unicode_minus”] = False

Import data

file = pd.read_excel(‘Three moment method.xlsx’,header=None,names=[‘x’, ‘value’])

data = pd.DataFrame(file)

数组切片

x = data[‘x’] # Take the first column of data

y = data[‘value’] # Take the second column of data

Spline interpolation of correlation functions in SciPy Library

tck = interpolate.splrep(x, y) #(t,c,k)包含节点向量、B样条曲线系数和样条曲线阶数的元组。

xx = np.linspace(min(x), max(x), 200)

yy = interpolate.splev(xx, tck, der=0)

x1,x2=

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/803885
推荐阅读
相关标签
  

闽ICP备14008679号