Can I use "place" function to adaptively update controller gain K when running model in Simulink?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am running my model in Simulink, then send some information to the Matlab function which is used for updating controller gain K. In Matlab function, I call another m file from Matlab environment which has "place" function inside. The error is "place" is not supported for code generation.
How can I solve that problem?
댓글 수: 0
답변 (1개)
Sam Chak
2025년 5월 14일
Hi @Quang Manh
If the place() function is not supported for code generation, you will need to program the computation manually. After all, the essence of the pole placement technique, in mathematical terms, is fundamentally about solving algebraic equations.
%% system
A = [0, 1 % state matrix
-6, -5];
B = [0 % input matrix
1];
eA = eig(A) % eigenvalues of open-loop system
%% Manual Pole Placement
e = [-5, -7]; % desired closed-loop eigenvalues
p2 = poly(e) % desired characteristic polynomial
k1 = p2(3) + A(2,1); % gain 1 (proportional)
k2 = p2(2) + A(2,2); % gain 2 (derivative)
K = [k1, k2] % control gain matrix
%% verify the result with computational pole placement
K = place(A, B, e)
Aa = A - B*K
eig(Aa) % eigenvalues of closed-loop system
댓글 수: 5
Sam Chak
2025년 5월 16일
Please consult with the technical support team. They should be able to help you.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Computations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!