How to use symbolic math toolbox to generate the gradient of a very long function?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am currently trying to use fmincon for Nonlinear Model Predictive Control. Typical MPC modeling has its objective function dependent on the length of the horizon, i.e. the number of elements in the optimum solution. My problem is almost same as the closed loop Matlab simulation example given in Swing-up Control of a Pendulum The differences compared to my model are: 1. I am using 4th Runge-Kutta method instead of Euler 2. The expressions used to define the continuous model have other components like tanh function and so on.
The problem is that the objective function becomes more and more complex when the length of the optimum solution increases. The expressions become very long and it takes eternally long time to generate those expressions when the length of optimum solution is greater than 4.
I have to generate the expressions for a length of atleast 25. Is there a work around to do this? I understand that longer expressions mean longer time but any tips to make it faster would be appreciated.
Thanks in advance
3 comentarios
Christopher Creutzig
el 3 de Dic. de 2018
It may be worth including your expressions in the question. Or, if you prefer not to make them public, contact support@mathworks.com, so the Symbolic Math team has a chance to look at your problem and either give hints to increase the performance or get feedback about places the toolbox can be improved. Or both.
madhan ravi
el 3 de Dic. de 2018
@Christopher I am a big fan of symbolic math toolbox it makes the life a lot easier.
Respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!