MATLAB: How to build a spline interpolation from scratch using only functions available for standalone code generation

spline

Hi all, I am trying to build a spline interpolation from scratch using only functions available for standalone code generation from the list attached below. That list is for 2011 and I am working with a matlab 2013 but I believe there is not much difference between them.
My goal is to place it in a hardware real-time simulator. I can't use a different matlab version, can't use extrinsic functions, s-functions or most available matlab functions typically used to generate splines such as "spline or interp1(….,'spline')", or other used internally by the previous themselves such as "mkpp, pwch, spdiags, spapi", etc.
I'm struggling to find a way to do it that doesn't involve a painfully long script which may end up being really computationally inneficient. Any input or ideas are welcome. http://uk.mathworks.com/help/releases/R2011a/toolbox/eml/ug/bq1h2z7-11.html

Best Answer

So, you can't use existing tools that do create a spline.
You don't want to write a "long" semi-involved script that will work, probably because that would force you to spend the time to really understand how to build a spline.
And you need to use only tools that existed in a fairly old release of MATLAB.
Then sorry, you can't build a spline. At least, I won't write the code for you to use.
You can probably find a code on the file exchange. (Have you bothered to look?) Beware that almost any code on the file exchange that generates a simple cubic spline will probably be worth exactly what you paid for it - NOTHING. (Because they will be the work of a student, as a homework assignment.) So, look on the file exchange, but sift carefully though what you will find. In fact, I just looked on the FEX under "cubic spline", and I saw very little that I would recommend. You won't be able to use my SLM toolbox up there, which while that would in theory solve your problem, it calls the optimization toolbox in some cases. That would probably make it unacceptable for code generation.
You MIGHT try this one:
It should be decent code, since I would trust the author. I have no idea if it will be viable for code generation though.
Related Question