Hi everyone,
I’ve been using a simple interpolation function like this:
Φ(ϕ, t) = interpolate((0 : 7/length(ϕ) : 7,), vcat(0, ϕ), Gridded(Linear()))(t)
This uses linear interpolation with Interpolations.jl
, and it works well for what I need so far.
However, I’d like to switch to a monotonic cubic interpolation, specifically using either the Fritsch-Butland or Steffen methods, as they avoid overshooting and better preserve the shape of the data. I found references to these in Interpolations.jl documentation, but I’m not sure how to implement them directly in this context.
To make things concrete, here’s a small test case:
ϕ = [1.0, 3.0, 2.5, 4.0]
t_test = 3.5
I’d like to evaluate Φ(ϕ, t_test)
using both linear interpolation (as above), and monotonic cubic interpolation.
Could someone show how to adapt the function to use these monotonic interpolators?
Thanks a lot for the help!