📄 gre.m
字号:
function [P,D1,D2]=gre(A0,A1,B,delay,M,N)
%GRE solves the generalized Ricatti equations corresponding to
% the linear quadratic regulator problem for systems with delays.
% For the system x'= A0*x + A1*y(-delay) + B*u , this function can be
% used for calculating the coefficients of the optimal control
%
% u=-inv(N)B'Px+integral(-delay,0,D0*exp(D1)*D2*y(s))ds
%
% INPUT :
% A0,A1,B - System coefficient
% delay - State delay
% M - Positive symmetric nxn state weighting matrix(n is the system order)
% N - Positive symmetric input weighting matrix
% OUTPUT :
% P - Solution of P*A0+A0'*P+M=P*K*P
% K=B*inv(N)*B'
% D1=-(P*K-A0')
% D2=exp(D1*delay)*P*A1
%
misdefinite=isdef(M);
nisdefinite=isdef(N);
if((length(misdefinite)==17) & (length(nisdefinite)==17))
if((sum(misdefinite=='positive definite')==17)&(sum(nisdefinite=='positive definite')==17))
[gain P eigenvalue]=lqr(A0,B,M,N);
K=B*inv(N)*(B');
D1=-(P*K-A0');
D2=expm(D1*delay)*P*A1;
else
disp('You must input positive matrix M and N');
end
else
disp('You must input positive matrix M and N');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -