Questions tagged [splines]

Smooth polynomial functions that are piecewise-defined.

67 questions
1
vote
1 answer

Indicator functions in Matlab-Splines

Alrighty, I have run into a silly problem and both my own work and internet searching haven't really provided a solution, so I wanted to ask and see if anyone has any suggestions. I'm writing a Matlab program that is ultimately meant to draw…
A. Masssey
  • 169
  • 1
  • 3
  • 10
1
vote
0 answers

Debugging construction of splines between a variable amount of points

Given an amount of points in x and y I want to create splines that intersect all points and that have the same slopes in intersections. My approach has been to establish a set of equations for intersection of points as well as dictating equal slopes…
user16951
  • 23
  • 3
1
vote
2 answers

Graphviz splines=false has no effect on undirected graph with bi-directional a -- b/b -- a edges

I am drawing an undirected graph with Graphviz that has redundant edges, (e.g. A -- B and B -- A). I would like to see only one line between the two vertices, regardless of whether there is a redundant reverse edge in the data. My question is, is…
Bryce Thomas
  • 10,479
  • 26
  • 77
  • 126
0
votes
1 answer

setting smoothing parameters in d3 js smoothing splines

I'm trying to set the smoothing parameters (lambda) using one of the smoothing libraries in the d3 js (d3.curveBasis, curveBasisClosed ...etc), but I'm not sure how to do it. The following is exactly what I want -…
0
votes
2 answers

evaluate (i.e., predict) a smoothing spline outside R

I fitted a smoothing spline to data in R with library(splines) Model <- smooth.spline(x, y, df =6) I would like to take the fitted spline and evaluate it for arbitrary new data in an external code (not in R). In other words, do what the…
DeltaIV
  • 4,773
  • 12
  • 39
  • 86
0
votes
1 answer

Drawing a line through given points (spline) with R

I am given x = c(50, 37, 25, 0) and y = c(30, 52, 65, 70). These are vectors containing the x and y coordinates of four points. I need to draw a smooth curve through all four points, and get the actual equation for this function. How do I accomplish…
user162381
  • 101
  • 1
0
votes
0 answers

Plotting B-splines in R

I am trying to create a B-spline basis of order 4 for a data set of 106 with 40 internal knots. All the plotted basis functions I've seen so far consists of very smooth and nicely spread out curves, whereas mine is pointy and generally pretty ugly…
estenhl
  • 59
  • 9
0
votes
0 answers

About BSplines and Beziers

I'm doing a small drawing-test program and I'm drawing curves. While it has been pretty easy with Beziers, I'm stuck with Splines. Like with first, when I click in the window, I add a knot, but honestly I don't get how to draw my curve from here:…
IssamTP
  • 2,408
  • 1
  • 25
  • 48
0
votes
0 answers

How do I get the output columns of ns/bs into a data.table in R?

I have a data.table of features for example: library(data.table) m = data.table(x1=rnorm(10),x2=rnorm(10)) Normally if I wanted a natural spline basis expansion for one of the features in lm I could do something like: library(splines) m[,lm(x2 ~…
Palace Chan
  • 8,845
  • 11
  • 41
  • 93
0
votes
1 answer

How do I make a piecewise constant formula term?

I can produce a model matrix for a piecewise linear spline like this: > k=seq(0,8,by=2) > x=seq(0,6,by=1) > bs(x, degree=1, knots=k, Boundary.knots=c(min(k),max(k))) 1 2 3 4 5 6 [1,] 1.0 0.0 0.0 0.0 0 0 [2,] 0.5 0.5 0.0 0.0…
Paul
  • 3,321
  • 1
  • 33
  • 42
0
votes
0 answers

Evaluate smooth.spline at specific point in R

In R, I'm using smooth.spline {stats} function to fit a spline through some function values. x=seq(0, 1,0.01) y=sin(x*23) - 0.6*cos(x*7) plot(x,y) ss= smooth.spline(x=x, y=y, df=35) plot(ss) Now ss object contains all the values of the fitted…
Herzog
  • 1
  • 1
0
votes
1 answer

Casteljau c++ Vector2D Spline

I doesent get the deCasteljau to run. I wrote comments in the code i doesent check. Here the pseudoCode for deCasteljau: DeCasteljau(anz, P[], t){ for(j=anz-2; j>=0; j--) for(i=0; i<=j; i++) P[i]=(1-t) * P[i] + t * P[i+1]; } I must use the…
user3181885
  • 49
  • 2
  • 9
0
votes
1 answer

B spline basis function seems to produce incorrect values

i wanted to implement B-splines in an Java Swing application. And since 4. May i tried nearly everything and spend every minute of my free time, but i don't get them right - i have headach since yesterday :/ To implement the B spline i used the…
Soraphis
  • 706
  • 7
  • 26
0
votes
1 answer

How to use StreamGeometry class on Windows Phone

I try to draw curve reference to Petzold Book Block and I try use this in Windows Phone 8. These libraries not support StreamGeometry class in namespace System.Windows.Media. How to try draw it on WP8? Thanks
Lê Văn Thành
  • 101
  • 1
  • 2
  • 7
0
votes
1 answer

Plotting smooth curves using scipy.interplote.interp1d and matplotlib Python 2.7 32-bit (Enthought Canopy)

I've calculated the curve of best fit for a scatter graph and I'd like to plot the results as a smooth curve, similar to SAS's splines. After some Googling it found that I should first use interpolate.interp1d on my data before plotting the line.…
Jason
  • 4,346
  • 10
  • 49
  • 75