|
A Four-Point Spline interpolation of a specified range of the current trace is performed using a modified 'spline-like' slope matching algorithm. A different cubic polynomial is derived for each 4 point region. The calculations assume that X = 0 at the left point of the region and X = 1 at the right point. Y1 and Y2 are the Y values of these two end point points. Also, Y0 and Y3 are the Y values of the points just before and after the former. It is assumed that the slope at a given point is the average of the slope between it and the previous point and the slope between the next point and itself. Thus the slopes at the left and right edges of the region are: s1 (Y2-Y0)/2 s2 (Y3-Y1)/2
For each point: Y = f(x) a*x^3 + b*x^2 + c*x + d df/dx 3*a*x^2 + 2*b*x + c
In solving for a,b,c,d four constraints are used: f(0) = y1 d f(1) = y2 a + b + c + d = a + b + c + y1 (df/dx)(0) = s1 c (df/dx)(1) = s2 3*a + 2*b + c = 3*a + 2*b + s1
Solving for the coefficients gives: a 2*y1 - 2*y2 + s1 + s2 b 3*y2 - 3*y1 - 2*s1 - s2 c s1 d y1
The middle points are filled in using a matrix (M). Each column of the matrix corresponds to one region between two of the original points. The top-most column value is the original Y1 at the left side of the region. The top-most value for the next column is the original Y1 at the right side of the region. The lower rows correspond to intermediate X values equally spaced between the original points. Since it was assumed above that X=0 at the left point of the region and X=1 at the right point, then X=1/factor for the second point and X=1 at the right point, we can use X=1/factor for the second row, X=2/factor for the third row, ... X=(factor-1)/factor for the bottom row.
|