⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 riccati.m

📁 市面上电力系统的范例 直得收藏学习的ㄧ本书
💻 M
字号:
function [tt,s,k, t,x]=riccati

% Hadi Saadat,  1998

% This function returns the optimal feedback control K(t) and the solution
% of the state equation.   First a function called [A,B Q,R,t0,tf,x0]=
% system(A,B Q,R,t0,tf,x0) containing system parameters and the matrices
% Q and R must be defined in a file named `system.m'.  The program calls
% upon two functions. The function [pot]=riccasim(t,p) solves the matrix
% Riccati equation defined by p(t). The second function [wdot]= statesim(t,w)
% solves the state equation in conjunction with the optimum control equation.
global A B Q R t0 tf x0
[A,B,Q,R,t0,tf,x0]=system(A,B,Q,R,t0,tf,x0)
n=length(A);nsq=n^2;
p0=zeros(1,nsq);
tol=0.0005; trace=0;
tspan=[t0, tf];
[t,p]=ode23('riccasim',tspan, p0);
tt=tf-t;
r=inv(R);
m=length(p);
for i=1:m
ss =reshape(p(i,:),n,n)';
s(n*(i-1)+1:n*i,1:n) =ss;
k(i,:)=r*B'*ss;
end
w0=[p(m,:),x0];
[t,w]=ode23('statesim',t0,tf,w0,tol,trace);
x(:,1:n)=w(:,nsq+1:nsq+n);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -