gre.m
来自「一个时滞系统的工具箱」· M 代码 · 共 34 行
M
34 行
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 + =
减小字号Ctrl + -
显示快捷键?