quadprog fails because of unrelated code
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a Simulink model that's supposed to simulate a Generalized Prediction Control on a plant. However, the quadprog function fails when I complete the code. When I delete part of the code, it works (but because the code is incomplete, the control as a whole doesn't work).
More specifically, in the attached model, in the "control block" subsystem, in the "controller" MATLAB Function, after line 58, I have this:
coder.extrinsic('quadprog');
U = zeros(size([0; 0; 0; 0]));
U = quadprog(H, b, [], [], [], [], [0; 0; 0; 0], [100; 100; 100; 100]);
f0 = ((F - W)') * (F - W);
u1 = u1m1 + U(1) + f0;
u2 = u2m1 + U(2) + f0;
As it is, it gives me:
An error occurred while running the simulation and the simulation was terminated
Caused by:
The interior-point-convex algorithm requires all objective and constraint values to be finite.
If I comment "+ f0", the simulation works but doesn't do what I'm expecting.
How do I make it work?
I'm using MATLAB R2017a on Debian 9.
Thanks in advance.
댓글 수: 0
채택된 답변
Walter Roberson
2017년 12월 19일
Is there feedback from the output of the block to the input? If so then it is possible that at some point the output of becomes infinite, and then that infinite value gets fed back to becoming infinite input that gets complained about. When you comment out the two indicated lines, the output is U(1) and U(2) are not used and so infinite output would not end up as feedback.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Model Predictive Control Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!