Questions tagged [cubic-spline]

A cubic spline is a smooth 3-order polynomial function that is piecewise-defined, and possesses a high degree of smoothness at the knots where the polynomial pieces connect.

A cubic spline is a smooth 3-order polynomial function that is piecewise-defined, and possesses a high degree of smoothness at the knots where the polynomial pieces connect. The most common cubic splines are Hermite, B-splines and Bezier splines.

Further details can be found at the sites below:

  1. wikipedia
  2. mathematica
170 questions
3
votes
2 answers

Get subject-specific peak velocity and age at peak velocity values from linear mixed spline models

I am fitting a linear mixed effects model with a natural spline function for age in order to describe the nonlinear trajectory for a repeated outcome y (bone mineral content in grams) across time (age in years). How can I solve the spline…
aelhak
  • 441
  • 4
  • 14
3
votes
1 answer

Gekko cspline function for FOPDT model (Dead-time) simulation

To simulate the dead-time in the FOPDT model using the GEKKO package, I used the Gekko 'cspline' function to make the time-shifting operation smoother. It works well when the input changes after the length of dead-time. (eg. The input changes at…
Junho Park
  • 997
  • 4
  • 12
3
votes
2 answers

How should I use univariate spline to fit a specific shaped data?

enter code hereI am trying to fit a spline to two sets of data points in order to normalise and compare them along a common x linspace. The data points represent a radiation profile, the shape looks like a tower. I can't use UnivariateSpline with…
3
votes
0 answers

Runtime warning by using cubic splines for interpolation

I have to develop a data snooping function in which I divide my dataset, which is in a pandas dataframe, in smaller parts and interpolate there a cubic spline (which are the Z- Values in my case). For this I used the interpolate.interp2d function…
Dennis
  • 171
  • 3
  • 16
3
votes
2 answers

Why does `ns(0.8)` or `ns(c(0.8))` return `NA/NaN/Inf in foreign function call (arg 1)`?

Why does ns(0.8) or ns(c(0.8)) return NA/NaN/Inf in foreign function call (arg 1)? ns(c(0.8, 1.0)) works fine but I wonder why giving just 1 value to ns causes a NA/NaN/Inf in foreign function call (arg 1). Example: > library(splines) >…
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
3
votes
2 answers

Conditions for smooth cubic bezier curve

I have the start and end points and the values of the slope of the curve at those points. Now I have to draw a "smooth 2D bezier curve" through the two given points. Now how to locate the two control points to achieve this. Is there any way for it?…
Chinni
  • 1,199
  • 1
  • 14
  • 28
2
votes
1 answer

SVG animateTransform scaling keySplines to match Y component of rotating vector

I need to simulate a rotating arrow in 2D. It has to keep pace with the rotating blue arrow. I started with keySplines shown by the red arrow that gave a nice quadrant when viewed using http://franzheidl.github.io/keysplines/ But it didn't match the…
Peter Hill
  • 43
  • 1
  • 6
2
votes
0 answers

How to workaround non-smooth result of Matlab function csaps

My goal is to find smoothing curve for the large amount of non-uniformly spaced data, such that minimal amplitude of curve is as big as possible. "csaps" function seems to be what I need, because it allows to get different degree of smoothing by…
Shinrei
  • 21
  • 3
2
votes
1 answer

Cubic spline or polynomial interpolation of non strictly increasing x in Scilab

I have a set of xy points: x = [1 2 3 3 2] y = [1 1 2 3 2] I would like to do an interpolation of those point. My issue is, interp1() or splin() require a strictly ecreasing x. How can I get an interpolation like this: x = [1 2 3 4 5] y = [1 1 2 3…
Ull
  • 23
  • 3
2
votes
0 answers

Elegant Algorithm for finding Maximal Point of Cubic B-Spline Basis Function?

Right now, I'm currently implementing a (potentially non-uniform) B-Spline Curve. One feature that I would like to have is the ability to know where on the curve a control point has the most influence. From my understanding, this is equivalent to…
2
votes
2 answers

scipy.interpolate.make_interp_spline how to retrieve all the coefficients?

I have the following program: nknots = 4 x_i = [0, 1, 2, 3] y_i = [1, np.exp(1), np.exp(2), np.exp(3)] coeff = interpolate.make_interp_spline(x_i, y_i, bc_type="natural") I want to construct a cubic spline using the knots whose coordinates are…
2
votes
1 answer

Why does the second derivative of a Cubic spline look so jaggy?

I need to use a cubic spline (I am mainly interested in higher order derivatives) and I found this example from scipy https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.interpolate.CubicSpline.html (the first one with a sin function).…
JohnDoe122
  • 638
  • 9
  • 23
2
votes
1 answer

Does this published Cubic Spline Extrema code have errors?

I am attempting to implement the Cublic Spline Extrema Algorithm published in 1996. I am not an accomplished programmer, and it is clear the author is, and is an order of magnitude or two smarter than I. However when I try and compile this, it…
Mtl Dev
  • 1,604
  • 20
  • 29
2
votes
0 answers

How to use smoothing splines in gam in the R package mgcv

The question is that is this the correct way to specify the knots in the smoothing spline in gam in mgcv? The confusion part is that in the vignette, it says the k is the dimension of the basis used to represent the smooth term. (Previously I…
vtshen
  • 202
  • 1
  • 11
2
votes
1 answer

restricted cubic spline for crr model (cmprsk)

I'm attempting to make a competing risk survival model using the crr function (cmprsk) in R and through preliminary analysis, I want to transform two of my continuous variables with a restricted cubic spline transformation. Does anyone know of a way…
Emma
  • 33
  • 5
1
2
3
11 12