Convert cfit model to C code

Hello,
How do I convert a cfit object (piecewise polynomial) and export that to standard C code as a function? I want to run the function from a microcontroller.
I am only interested in the value and not the other methods. I have attached the foo.mat which contains the cfit object and the script that I use to call it.
I should have an entry point function somehow with the model?
Edit: Alternatively I can reconstruct the piecewise polynomial model as a function. I would also like to know for future reference, whether I can export other curve fitting algorithm from Matlab into C? Such as Lev-mar (parametric fitting)?

1 件のコメント

Tony Tse
Tony Tse 2017 年 12 月 7 日
編集済み: Tony Tse 2017 年 12 月 7 日
I looked at it further and ended up extracting the breaks and coefs using unmkpp, which are hardcoded in my microcontroller. I converted mkpp and ppval into C. Hopefully this will work well.
I am still wondering about parametric curve fitting in C though.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

タグ

質問済み:

2017 年 12 月 7 日

編集済み:

2017 年 12 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by