Doug Jenkins wrote:
ALGLIBNewbie - I don't have time to look at the C++ version, but it seems to work in VBA. One thing is that it seems that M (number of functions) needs to be an even number, so try your code with M = 4 or 6!
Thank you very much, Doug! Indeed the
number of functions set to an even number makes my code run. Boy, I can't believe days went by with all it needed was setting "5" to "6".
Okay, this means I can
address now the
spline1dfithermite function of ALGLIB. On to the next step, that is the maths. Again, I have no clue whether
spline1dfithermite is actually the function that suits my mathematical problem. To recap: My only input is 56 x-values and corresponding 56 f(x)-values. I need a math function that displays the curve just as Excel does. I suspect the form of the function to be something like
f(x) = [ax^5 + bx^4] + cx^3 + dx^2 + ex + f. Means, I actually only need the coefficients a, b, c, d, e and f calculated.
So now where I get some results from
spline1dfithermite I give it a try to hopefully do that.
The obvious main return object is
spline1dinterpolant.
Code:
struct spline1dinterpolant
{
bool periodic;
int n;
int k;
ap::real_1d_array x;
ap::real_1d_array c;
};
I set the
number of functions M which I learned must be an even number to 6. And after executing
spline1dfithermite with my 56 x/y data columns
spline1dinterpolant supplies these values:
ap::real_1d_array c delivers:
Attachment:
scre1.PNG [ 2.51 KiB | Viewed 22737 times ]
ap::real_1d_array c delivers:
Attachment:
scre2.PNG [ 574 Bytes | Viewed 22737 times ]
n is 4,
k is 3, and
periodic is false.
And I have only but one more question and we're done: What does all this mean? Is
c the list of coefficients? That would be great.
Doug Jenkins wrote:
GetSplineData is my VBA routine to convert the input variant arrays into the correct form for the AlgLib VBA routines.
I studied your VBA code briefly. I can somewhat read what's going on but the mathematical background fails me.
One final remark: I could be light years away from the solution. But please don't give up on me, hahaha... I think it will be most valuable to the LIB-forum if you math pros keep giving a hand to absolute outsiders.