Splint Fit Test Case

The tst_spline program was added to the cgcam repository on 10/17/2022. This routine will create a data sequence that is representative of a thermal duct. The program prompts the user for the number of points in the data sequence, which allows for a range of sampling from under-sampled to over-sampled. The program will then fit the data with a cubic spline and ask the user to specify an up-sampling factor to be used in writing out the spline fit function value along with the corresponding values for the first and second derivatives. The data sequence is written to the file data.out whereas the spline fit is written to the file fit.out.

The plots below were generated by specifying 17 points for the data sequence and an up-sampling factor of 6. As shown below, the data sequence is coarsly sampled
winds
but the spline fit to it is nice and smooth.
winds
The first derivative is also smooth
winds
The second derivative is continuous, but is not smooth, since it is effectively rendered with a linear fit.
winds
While a zoomed-in plot of the first derivative may give a non-smooth appearance,
winds
this is just an artifact of the plotting algorithm which simply draws straight line segments between adjacent data points. This effect becomes very hard to see if the sampling interval for the fit is increased by adjusting the up-sampling factor to 20.
winds