File Exchange

image thumbnail

Spline based function approximation for HDL synthesis

version (20.9 KB) by

This is a suite of simple utilities that allow for efficient approximation of complex functions in a

1 Download


View License

This tool accepts a function handle for a "well behaved" function. It then automatically finds the best position for the knots for cubic spline approximation based on the error tolerance specified by the user. Areas of the approximation region with more rapid changes require more closely placed knots.
Once the knots are positioned and the requested error tolerance is achieved, a computation is made to convert the coefficient tables to fixed point. The lookup operation is automatically coded in EML. Note that the best way to code the EML lookup operation is with a linear O(n) search, that will be further optimized by the synthesis tools.

To demonstrate the utility of these functions, run the "example.m" function that is included with this submission.

Comments and Ratings (2)

Sean Little

The best thing I can tell you is to experiment and see what the function can do for you. I had a great time writing this, but I have not even looked at this code in a long time. Sorry I can't be more helpful.


DN (view profile)

Hi Sean,

This is really good, many thanks. I'm trying to interpolate the pchip (Piecewise Cubic Hermite Interpolating Polynomial)function with HDL. We use pchip in Matlab so often as you know given its the most accurate for the poly fittings. These days we don't even specify pchip as an option in interp(), but just use pchip() straight from Matlab. I was wondering if your function with can handle this, given the knots will automatically adapt. Thanks again.


Updated license

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today