问题描述

记录今天看见代码里面用到scipy.interpolate.make_interp_spline()函数,主要学习https://blog.csdn.net/weixin_42782150/article/details/107176500 这篇博客的内容,记录一下自己的理解!
make_interp_spline是一种插值法,是一种曲线平滑处理的方法,下面看详细的代码实现:

import numpy as np
from matplotlib import pyplot as plt
from scipy.interpolate import make_interp_spline
# x->ndarrary(7), y->ndarrary(7)
x = np.array([6,7,8,9,10,11,12])
y = np.array([1.53E+03, 5.92E+02, 2.04E+02, 7.24E+01, 2.72E+01, 1.10E+01, 4.70E+00])"""
np.linspace 等差数列,从min(x)到max(x)生成300个数,便于后续插值,这里需要注意,设置为多少,
那么后面x_smooth和y_smooth的维度也会对应变化,例如这里设置300,那么x_smooth->ndarrary(300),
y_smooth->ndarrary(300)
"""
x_smooth = np.linspace(x.min(), x.max(), 300)
y_smooth = make_interp_spline(x, y)(x_smooth)plt.plot(x_smooth, y_smooth, label="later")
plt.plot(x, y, label='origin')
plt.legend()
plt.show()

对scipy.interpolate.make_interp_spline的理解相关推荐

  1. 成功解决ImportError: cannot import name ‘spline‘ from ‘scipy.interpolate‘—利用make_interp_spline函数绘制平滑的曲线

    成功解决ImportError: cannot import name 'spline' from 'scipy.interpolate'-利用make_interp_spline函数绘制平滑的曲线 ...

  2. 成功解决AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython

    成功解决AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython ...

  3. scipy.interpolate: 插值和平滑处理

    scipy有很多插值函数(方法),按维度可分为一维.二维和多维的插值方法,按方法包括拉格朗日和泰勒插值方法等,具体插值函数可参阅如下介绍: https://docs.scipy.org/doc/sci ...

  4. 如何优雅地平均多条曲线 scipy.interpolate.interp1d below the interpolation range error

    正确的思路应该是得到所有曲线,然后规定新曲线采样位置(x坐标),然后平均y值.下面的做法错了,因为ROC曲线上的任一个点的位置是清晰地定义好的,插值是画蛇添足. ------------------- ...

  5. python interpolate.interp1d_我如何使用scipy.interpolate.interp1d使用相同的X数组插值多个Y数组?...

    例如,我有一个二维数据数组,其中一个维度上带有误差条,如下所示: In [1]: numpy as np In [2]: x = np.linspace(0,10,5) In [3]: y = np. ...

  6. scipy.interpolate插值

    python  SciPy库依赖于NumPy,提供了便捷且快速的N维数组操作. 可以实现插值,积分,优化,图像处理,特殊函数等等操作. 参考官方文档: Interpolation (scipy.int ...

  7. python插值(scipy.interpolate模块的griddata和Rbf)

    1.插值scipy.interpolate SciPy的interpolate模块提供了许多对数据进行插值运算的函数,范围涵盖简单的一维插值到复杂多维插值求解. 一维插值:当样本数据变化归因于一个独立 ...

  8. matlab griddata插值太慢,非常慢的插值使用`scipy.interpolate.griddata`

    在长期忍受scipy.interpolate.griddata极其缓慢的性能之后,我决定放弃{ 所以对于上面的例子,上面问题中的那个,你可以得到输入文件here,这是一段需要1.1ms的代码,而在上面 ...

  9. scipy.interpolate插值方法介绍

    文章目录 scipy.interpolate插值方法 1 一维插值 2 multivariate data 3 Multivariate data interpolation on a regular ...

最新文章

  1. 力扣(LeetCode)刷题,简单题(第6期)
  2. 在 ASP.NET 网页中不经过回发而实现客户端回调
  3. React编写一个简易的评论区组件
  4. 无线网络(5) 无线网络安全性
  5. 剑指offer之36-40题解
  6. 冒泡排序java代码_数据结构与算法—冒泡排序(Java实现)
  7. 弹性式分布数据集RDD——Pyspark基础 (二)
  8. element ui后台html_GitHub上10个开源且优秀的后台管理系统UI面板
  9. 华为鸿蒙麒麟玉兔_华为P50除了麒麟9000,还预装鸿蒙系统,比iPhone12值得买
  10. stm32读取驾驶模拟器数据 stm32F407读取joystick数据
  11. 【一线】亚马逊AWS首席科学家:语音识别取得突破
  12. 秩和比综合评价法(RSR)详解及Python实现和应用
  13. 兴东机器人_福州市松下机器人维保中心
  14. 【算法专题】关键路径及代码实现
  15. 2022年8月22日 暑假第六周总结
  16. Kibana:更有效地构建 Kibana 仪表板 - 7.12 发布
  17. 搞模具的想转行学计算机,为什么很少人去做模具设计学徒,看看这里你就明白了!...
  18. Java的运算符——取整、取绝对值、取余数、求模
  19. 论文写作Word技巧
  20. 康普分享未来网络四大趋势 光纤将是最佳主角

热门文章

  1. Pinbar交易系统指标
  2. uni-app概念(新增)
  3. boris fx 教程_通过编程将金融工具分散化:Dfinance的Boris Povod访谈
  4. 寄存器由来 ES CS SS DS FS GS区别
  5. Mac OS 输入adb命令无效(zsh: command not found: adb)的解决方法
  6. Rtklib对流层改正记录
  7. selenium之chromedriver与chrome版本映射表(最新版!)
  8. 科研实验如何起草一份通俗易懂的SOP?
  9. 【智能优化算法】基于人工蜂群算法求解多目标优化问题附matlab代码
  10. AutoJs学习-趣玩版跳一跳相关代码