Skip to content

Periodic splines #43

Answered by jipolanco
dmbates asked this question in Q&A
Sep 20, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Below is a small example on how this can be done currently. I hope I can soon provide a higher-level (and more efficient) interface for this, but for now this seems to work correctly.

using BSplineKit
using LinearAlgebra

L = 2π  # period
Nx = 8  # number of points
k = 4   # B-spline order (4 for cubic splines)

# Knot vector -- note that we need to extend it on both sides.
dx = L / Nx
ext = (k - 1) * dx
ts = range(-π - ext, π + ext; step = dx)
xs = ts[k:(k + Nx - 1)]  # actual data points
@assert first(xs)  -π
@assert last(xs)  π - dx

# B-spline basis of order 4 (cubic splines)
B = BSplineBasis(BSplineOrder(k), ts; augment = Val(false))

# Build interpolation matrix
# (This is basical…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@dmbates
Comment options

Comment options

You must be logged in to vote
1 reply
@dmbates
Comment options

Answer selected by jipolanco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants