I have a neat little problem I hope you can help me with: I have a set of numbers in a line that I want to manipulate into a smooth curve. I know, and need to maintain, the average value over certain subsets of the numbers. For example, there may be 36 numbers and I know the average of the first 6 numbers is X, the average of the second six numbers is Z etc etc.
By setting the first value to a given number and setting the gradient to zero at the end point, I've managed to use cubic splines to smooth the curves and maintain the known averages. However the cubic splines, whilst working correctly, can go a bit whacky (screaming up and down)especially when consecutive known averages are significantly different. I need the curve to be a bit more restrained...
What I think I need is a method to minimise the total curvature - perhaps simply to minimise the sum of consecutive squared differences between one point and the next.
I get the feeling I should be able to do this in a single step linear algebra kind of way, rather than an itterative process, but can't figure out how to structure the problem.