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
1
vote
1 answer

Restricted Cubic Spline output in R rms package after cph

I am developing a COX regression model in R. The model I am currently using is as follows fh <- cph(S ~ rcs(MPV,4) + rcs(age,3) + BMI + smoking + hyperten + gender + rcs(FVCPP,3) + TLcoPP, x=TRUE, y=TRUE, surv=TRUE, time.inc=2*52) If I then…
Emma
  • 33
  • 5
1
vote
0 answers

What is the best method to generate a sinusoidal-appearing interpolation with maximums and minimums at the points you're interpolating between?

I have a series of values and times in an array. I want to create a spline fit wherein the derivative at every point that I give it is at zero. In short, I want to form a complex sinusoidal-looking wave from it. Each value should end up being either…
1
vote
1 answer

How to draw a graphviz spline in d3

Background graphviz is great for laying out graphs. When I layout my graph with graphviz "dot" it produces a file with nodes and edges tagged with positions. E.g. an edge: "a" -> "b" [pos="e,152.13,411.67 91.566,463.4 108.12,449.26 127.94,432.34…
Alex Lenail
  • 12,992
  • 10
  • 47
  • 79
1
vote
2 answers

Cubic spline interpolation vs polynomial interpolation

I am asked to investigate the different types of interpolation using Matlab for the following points: x = [32 34 35 36 37 38] y = [26 28 31 30 29 25] and find the values for f(33), f(33.5) and f(35). When plotting x and y, I can see that f(33)…
P.ython
  • 63
  • 1
  • 8
1
vote
1 answer

Strange result of spap2

I encounter strange results from spap2 on some data: The actual data is the blue curve, red circles are the knots I am using and yellow curve is the display of the cubic spline curve. The code is quite simple, I cannot figure out what is the…
Bentoy13
  • 4,886
  • 1
  • 20
  • 33
1
vote
1 answer

Extracting points coordinates(x,y) from a curve c#

i have a curve that i draw on a picturebox in c# using the method graphics.drawcurve(pen, points, tension) is there anyway that i can extract all points (x,y coordinates) been covered by the curve ? and save them into an array or list or any thing…
1
vote
1 answer

cubic spline interpolation produces only nans or throws an error

I am trying to downsample a dataframe from querterly to monthly. i = ['2000-01-01','2000-04-01','2000-07-01','2000-10-01','2001-01-01','2001-04-01','2001-07-01','2001-10-01'] d = [0,54957.84767,0,0,0,56285.54879,0,0] df = pd.DataFrame(index=i,…
delica
  • 1,647
  • 13
  • 17
1
vote
1 answer

Python cubic spline is interpolating strangely

I'm trying to interpolate using the cubic spline, but the interpolation fluctuates wildly around the data points. I don't know how to fix this. Any advice would be greatly appreciated. TY =…
1
vote
1 answer

Numerical integration of convolution of interpolating function

I have x and y arrays of data points that I have used to create an interpolating function func_spline as shown below. import numpy from numpy import loadtxt from scipy.interpolate import * x_given = numpy.arange(1,21400,21400/25000) y_given =…
1
vote
1 answer

Python: find x along cubic spline (returning y) which yields sequential (x,y) pairs in equal distance

assume I have a cubic spline from point [0,0] to [10,10], with boundary values of zero derivative: spl = scipy.interpolate.CubicSpline(x = [0,10], y = [0,10], bc_type=((1,0),(1,0))) If I take the output of the spline evaluated at x as its y…
J.Galt
  • 377
  • 1
  • 2
  • 10
1
vote
1 answer

How can I interpret the P-value of nonlinear term under rms: anova?

Here I demonstrated a survival model with rcs term. I was wondering whether the anova()under rms package is the way to test the linearity association? And How can I interpret the P-value of the Nonlinear term (see 0.094 here), does that support…
1
vote
1 answer

View interpolated values of cubic spline (R)

I want to perform cubic spline interpolation : x <- c(1,1.5, 2, 4,5,6,7,8,9,10,12,15,20, 25,30) y <- c(-0.402, -0.303, -0.198, 0.211,0.4133,0.606,0.7835,0.9404,1.0733,1.189,1.383,1.594,1.812,1.893,1.922) smooth.spline (x,y) you can notice that…
Jonathan
  • 99
  • 1
  • 8
1
vote
1 answer

How to get closest point on cubic spline for Robotics project?

I've got a robot and I want to make this robot follow a predefined path in the form of an eight figure on a field outside. The robot is not easy to steer and there are some external factors such as wind which make it very likely that the robot will…
kramer65
  • 50,427
  • 120
  • 308
  • 488
1
vote
1 answer

Different python functions to fit cubic splines, finding coefficients

I want to fit a cubic spline in Python to noisy x, y data and extract the spline coefficients for each interval (i.e. I would expect to obtain four spline coefficients for each interval) So far, I have tried (all from scipy.interpolate): 1)…
1
vote
1 answer

Cubic spline implementation in Octave

My bold claim is that the Octave implementation of the cubic spline, as implemented in interp1(..., "spline") differs from the "natural cubic spline" algorithm outlined in, e.g., Wolfram's Mathworld. I have written my own implementation of the…
robotopia
  • 23
  • 2
  • 6