2016-10-14 13 views
2

私は、規則的に間隔を置いて配置されたデータに対して1D関数を直線的に補間する最も速い方法に興味があります。 私はかなりInterpolations.jlscale機能を使用する方法を理解していない:Interpolations.jlでscale()を使用するには?

using Interpolations 
v = [x^2 for x in 0:0.1:1] 
itp=interpolate(v,BSpline(Linear()),OnGrid()) 
itp[1] 
# 0.0 
itp[11] 
# 1.0 
scale(itp,0:0.1:1) 
itp[0] 
# -0.010000000000000002 
# why is this not equal to 0.0, i.e. the value at the lowest index? 

答えて

2

scale!することによるよう関数は、オブジェクトを変更しません。

julia> sitp = scale(itp,0:0.1:1) 
11-element Interpolations.ScaledInterpolation{Float64,1,Interpolations.BSplineInterpolation{Float64,1,Array{Float64,1},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,0},Interpolations.BSpline{Interpolations.Linear},Interpolations.OnGrid,Tuple{FloatRange{Float64}}}: 


julia> sitp[0] 
0.0 

ありがとうございました。これを指摘していただきありがとうございます。spencerlyon