本文介绍了如何在python中内插一个累积函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有6分构成的累积函数(CDF).我必须对其进行插值,因此我使用了interp1d(从scipy.interpolate导入interp1d),结果如下:

I have a cumulative function (CDF) made of 6 points. I have to interpolate it so I used interp1d (from scipy.interpolate import interp1d), the results is the following:

蓝点是初始数据,红色曲线是线性内插后的.但是,我对此并不满意,特别是在第4点和第5点之间,线性关系的假设低估了真实曲线(如果我认为该曲线是S形或双曲线切线).因此,我尝试始终使用interp1d,但使用二次方和三次方,结果是灾难性的

the blue dots are the initial data and the red curve is after linear intepolation.However, I am not really happy about it especially between the point 4 and 5 the assumption of linear relation is underestimating the real curve (if I think of this curve as a sigmoid or hyperbolic tangent). Therefore I tried to use always interp1d but with quadratic and cubic and the result is catastrofic

输出没有意义,而且完全错误,所以我的问题是

the output makes no sense and it completely wrong, so my question is

如何使我的原始线性拟合更加平滑并且类似于真实的累积函数?谢谢,路易吉

how to make my original linear fit a bit more smooth and similar to a real cumulative function?Thanks, Luigi

推荐答案

尝试使用单调插值akima/pchip

Try monotone interpolants, akima/pchip

这篇关于如何在python中内插一个累积函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 14:12