필터 지우기
필터 지우기

Algebraic Riccati Equation Solution for Code Generation

조회 수: 44 (최근 30일)
SRance
SRance 2020년 11월 12일
댓글: Gary Zhang 2022년 4월 8일
Hi all,
Knowing that the lqr, care and icare functions do not currently support code generation, does anyone have an alternative (code or function) that can be used for the computation of the state variable gain for a linear quadratic regulator?
In the past I have gone down the route of trying to solve the algebraic ricatti equation (ARE) using the Hamiltonian matrix (below is for the CARE, though can be altered for the DARE) to get the ARE solution using the schur function.
Whilst the schur decomposition supports code generation I also needed the ordschur function, which does not support code generation, to reorder the eigenvalues.
I actually can't remember if the ordschur is critical to the solution, so part of my question is do I even need to reorder the decomposition in order to appropriately solve the ARE, and if so if theres an alternative to ordschur that is support for code generation?
Z = [A -(B/R*B'); -Q -A'];
[U, S] = schur(Z);
[U, S] = ordschur(U, S, 'lhp');
[m,n] = size(U);
U11 = U(1:(m/2), 1:(n/2));
U21 = U((m/2+1):m, 1:(n/2));
P = U21/U11;
K = inv(R)*B'*P
Thanks in advance!
Just some links for context:

답변 (2개)

Erivelton Gualter
Erivelton Gualter 2021년 6월 8일
The solution of riccati equation using Simulink was answed here:
It worked great for my application, which also evolves code generation. The solution is presented in the following link:
I needed to change a line of code. Just check the comments of this file exchange page.
  댓글 수: 1
Gary Zhang
Gary Zhang 2022년 4월 8일
Thank you very much Erivelton. Your first link is working for real time code gen.

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


Victory Friday
Victory Friday 2022년 2월 1일
Please did you finally find a way around it, I am having similar challenge.

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by