필터 지우기
필터 지우기

How to use symbolic math toolbox to generate the gradient of a very long function?

조회 수: 3 (최근 30일)
GKH
GKH 2018년 9월 5일
댓글: madhan ravi 2018년 12월 3일
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.
I tried to generate gradient and hessian as mentioned in: Symbolic Math Toolbox Example
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
Christopher Creutzig
Christopher Creutzig 2018년 12월 3일
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
madhan ravi 2018년 12월 3일
@Christopher I am a big fan of symbolic math toolbox it makes the life a lot easier.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Refinement에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by