Effacer les filtres
Effacer les filtres

How to call third party c++ library, e.g. ceres in Simulink?

5 vues (au cours des 30 derniers jours)
Jiangfeng Liu
Jiangfeng Liu le 6 Avr 2022
Réponse apportée : ag le 27 Sep 2023
I am planing to simulate an UAV with Simulink. I want to use the c++ library ceres-solver to do some optimization jobs. Therefore, I want to know if it's possible to utilize third party c++ library in Sinmulink. I searched about it, and as far as I know, S-Function block can be written by c++. But I don't know if it can only finish some simple or relatively simple implementations, or it can finish such kind of jobs. So any similar experience could be helpful. And thanks in advance!

Réponses (1)

ag
ag le 27 Sep 2023
Hi Liu,
I understand that you need to use the "ceres-solver" tool in SIMULINK.
To do that, you will have to first create an "MEX" file of the same, and then utilize it in the "MATLAB function block" in SIMULINK.
You can find pre-compiled MEX files for windows and Linux on the following link,
Alternatively, you can refer to the "optimize" MATLAB function, which can also be used to find a solution that minimizes the cost of the nonlinear least squares(available from R2022a release).
Please refer to the following documentations for more details,
  1. https://www.mathworks.com/help/releases/R2021a/simulink/ug/what-is-a-matlab-function-block.html
  2. https://www.mathworks.com/help/nav/ref/factorgraph.optimize.html
Hope this helps!
Best Regards,
Aryan Gupta

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by