Using symbolic syms inside a Simulink Function — Error: Symbolic not allowed
이전 댓글 표시
Hello everyone,
I am working with MATLAB/Simulink and trying to implement a time-varying LQR (TV-LQR).
At each simulation step, I want to:
- Take the desired state x_desired
- Linearize the nonlinear model around this state to compute matrices A and B
- Compute the LQR gain K
- Apply the control lawu=udesired−K(x−xdesired)u = u_{\text{desired}} - K (x - x_{\text{desired}})u=udesired−K(x−xdesired)
The problem is that Simulink gives an error saying that symbolic variables (syms) are not allowed inside a Simulink Function.
How can I linearize my model at each step without using symbolic variables in Simulink?
Is there a recommended way to do numerical linearization at runtime?
Thanks!
채택된 답변
추가 답변 (1개)
Walter Roberson
2025년 11월 25일
1 개 추천
You cannot mix symbolic variables and Control System Toolbox or Simulink Control Design https://www.mathworks.com/help/slcontrol/ug/linearize.html .
I am not aware of anything in the Symbolic Toolbox that would help to linearize models. (Though it is true that you can do some steps using the laplace transform of transform functions.)
In https://www.mathworks.com/matlabcentral/answers/305339-how-to-create-a-transfer-function-with-gain-k#comment_395202 I discussed the closest that you can get to symbolic variables using Simulink models (it is not very close.)
카테고리
도움말 센터 및 File Exchange에서 State-Space Control Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


