How can I build a spline interpolation from scratch using only functions available for standalone code generation?

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

 Risposta accettata

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.

1 Commento

Thank you. I don't think it's going to work for my application but I appreciate the input anyway. I've already built something similar based on a polynomial fitting savitzky-golay filter, but it seems that only a spline will do. When testing I also used the 'pchip' cubic interpolation but it didn't work properly either. It's all part of a Hilbert Huang Transform I am building, I'm reviewing the math to see if I can avoid it but since it is based on an empirical method (EMD) the math hasn't been demonstrated clearly from the beginning, and is rather separated in lots of papers.
I'm in the process of building it now, I just haven't done it before and wanted to see if there was some way to save me some time. Sometimes there are very good answers that point you to the right function. I can use existing tools, just not the ones outside the list. But fair enough, I guess that's what happens for asking a "lazy" question.

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by