Skip to content

Commit 4846b71

Browse files
Merge pull request #502 from ajatshatru01/master
Create clarification.md for interpolation concepts
2 parents 7e74106 + 89bcacf commit 4846b71

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ makedocs(
2727
"Manual" => "manual.md",
2828
"Smooth arc length interpolation" => "arclength_interpolation.md",
2929
"Inverting Integrals" => "inverting_integrals.md",
30-
]
31-
)
30+
"clarification.md"
31+
])
3232

3333
deploydocs(repo = "github.com/SciML/DataInterpolations.jl"; push_preview = true)

docs/src/clarification.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Clarifications
2+
We will clarify regarding the issues raised through this doc
3+
4+
# 0-order B-Spline Interpolations are not the same as Constant Interpolations
5+
```@example tutorial
6+
julia> using DataInterpolations, Plots
7+
julia> using DataInterpolations: derivative
8+
julia> u = [2.0, 1.0, 5.0, 4.0, 5.0, 4.0]
9+
julia> t = [0.0, 2.0, 3.5, 4.0, 5.0, 6.5]
10+
julia> bspline = BSplineInterpolation(u, t, 0, :Uniform, :Uniform; extrapolation_left=ExtrapolationType.Extension, extrapolation_right=ExtrapolationType.Extension)
11+
julia> plot(bspline)
12+
```
13+
A B-spline curve is constructed using control coefficients, hence, the jump locations are at knot vectors and do not coincide with data points(which is the case for constant-interpolation).
14+
Thus, the plot for B-Spline interpolation does not appear the same as the plot for Constant Interpolation.
15+
16+
# Derivative behavior of quadratic B-Spline
17+
```@example tutorial
18+
bspline = BSplineInterpolation(u, t, 2, :Uniform, :Uniform; extrapolation_left=ExtrapolationType.Extension, extrapolation_right=ExtrapolationType.Extension)
19+
plot(t->derivative(bspline, t))
20+
```
21+
The derivative becomes piecewise linear with jumps, and extrapolation can introduce sharp artifacts near boundaries, additionally derivative(bspline, t) is calculated by differentiating the spline basis and evaluating outside nominal knot spans using extension, not clamping.
22+
Hence, sudden spikes near the ends and sharp negative excursions where basis support ends.

0 commit comments

Comments
 (0)