How can i solve Algebraic Ricatti Equation for SDRE controller?
이전 댓글 표시
I have a model in simulink. I use SDRE controller for that model . I can obtain SDC matrices(A(x) and B(x)) by matlab function in simulink . One of the example in simulink matlab function is :
function P = fcn(u,w)
%#codegen
B = [ 0 2 2 0 ;
1 0 0 3 ;
0 4 5 0 ;
0 0 3 0 ;
0 4 0 0 ] ;
A = [2 0 4 u 0 ;
0 5 0 0 0 ;
6 0 7 w 0 ; 1 0 0 0 0 ; 0 1 0 0 0 ] ;
Q= diag([0.6 0.6 0.6 2.6 0.5]);
R= diag([0.00001 1000 1000 1000]);
n = size(A,1);
P = zeros(n,n);
H = [A -(B/R)*B'; -Q -A'];
[T,L] = eig(H);
lambda = diag(L);
ord_lambda = zeros(1,2*n);
for k = 1 : 2*n;
if real(lambda(k)) < 0
ord_lambda(k) = -1;
elseif real(lambda(k)) > 0
ord_lambda(k) = 1;
else
%disp('!!!');
end
end
[~, ord_index] = sort(ord_lambda, 'descend');
T_ord = T(:,ord_index);
T22 = T_ord(n+1:2*n,n+1:2*n);
T12 = T_ord(1:n,n+1:2*n);
P = real(T22/T12);
댓글 수: 2
burak ergocmen
2017년 11월 26일
편집: burak ergocmen
2017년 12월 8일
Victory Friday
2022년 1월 31일
Please sir, is there a way out in ordering the eigenvalues for script?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Computations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!