In order to specify some things first: The user should be able to create a graph by specifying 3 to 5 points on a 2D field.
The first and the last points are always at the bounds of that field (their position may only be changed in y direction – not x). The derivation of the graph at these positions should be 0.
The position of the 3rd and following points may be specified freely.
A graph should be interpolated, which goes through all the points. However, this graph should be as smooth and flat as possible. (please apologize for not being mathematically correct)
The important thing: I need to sample values of that graph afterwards and apply them to a discrete signal. Second thing: Within the range of the x-Axis the values of the function should not exceed the boundaries on the y-Axis.. In my pics that would be 0 and 1 on the y-Axis.
I created some pics to illustrate what I am talking about using 3 points.
Some thoughts I had:
- Use (cubic?) splines: their characteristics could be applied to form such curves without too many problems. However, as far as I know, they don’t relate to a global x-Axis. They are specified in relation to the next point, through a parameter usually called (s). Therefore it will be difficult to sample the values of the graph related to the x-Axis. Please correct me when I am wrong.
- create a matrix, which contains the points and the derivations at those points and solve that matrix using LU decomposition or something equivalent.
So far, I don’t have in depth understanding of these techniques, so I might miss some great technique or algorithm I haven’t known about yet.
There is one more thing, that would be great to be able to do: Being able to adjust the steepness of the curve via the change of one or a few parameters. I illustrated this by using a red and a black graph in some of my pictures.
Any ideas or hints how to solve that efficiently?




Do you understand how splines are arrived at?
Summary of doing splines
You break the range into pieces based on the control points (splitting at the control points or putting the breaks between them), and plop some parameterized function into each sub-range, then constrain the functions by the control points, artificially introduced end-point constraints, and inter-segment constrains.
If you’ve counted your degrees of freedom and constraints right, you get a solvable system of equations which tells you the right parameters in terms of the control points and away you go.
The result is a set of parameters for a piecewise function. Generally a piecewise continuous and differentiable function, because what would be the point otherwise.
How you can use that in this case
So consider making each interior point the center of a segment which will be occupied by a peak-like function (Gaussian on a linear background, maybe) and use the end points as constraints.
For
ntotal points you’d haveD*(n-2)parameters if each segment hasDparameters. You have four end-point constraintsf(start)=y_0,f(end)=y_n,f'(start) = f'(end) = 0), and some set of match constraints between the segments:plus each segment is constrained by it’s relationship to the control point (usually either
f(point n) = y_norf'(point n) = 0or both (but you get to decide).How many matching constraints you can have depends on the number of degrees of freedom (total number of constraints must equal total number of DoF, right?). You have have to introduce some extra endpoint constraints in the form
f''(start) = 0… to get it right.At that point you’re just looking at a lot of tedious algebra to earn how to translate this into a big system of linear equation which you can solve with a matrix inversion.
Most numeric methods books will cover this stuff.