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

📄 opt_app.m

📁 控制系统计算机辅助设计——MATLAB语言与应用(源代码)
💻 M
字号:
function G_r=opt_app(G_Sys,nn,nd,key,G0)
%OPT_APP finds the optimal reduced model.
%  
%G_r=opt_app(G_Sys,nn,nd,key,G0)
%     where G_Sys is the original model.
%       nn, dd are the expected orders of num and dem.
%       key is the id to show whether delay is allowed in the
%          reduced order model.
%       G0 is the initial model, if needed.
%       Gr is the reduced order model.

%Designed by Professor Dingyu Xue
%Northeastern University, Shenyang 110004, P R China
%first drafted in 1998, revised for LFC book, 2002
GS=tf(G_Sys);
num=GS.num{1}; den=GS.den{1};
Td=totaldelay(GS);
GS.ioDelay=0;
GS.InputDelay=0;GS.OutputDelay=0;
if nargin<5,
   n0=[1,1];
   for i=1:nd-2, n0=conv(n0,[1,1]); end
   G0=tf(n0,conv([1,1],n0));
end
beta=G0.num{1}(nd+1-nn:nd+1);
alph=G0.den{1}; Tau=1.5*Td;
x=[beta(1:nn),alph(2:nd+1)];
if abs(Tau)<1e-5, Tau=0.5; end
if key==1, x=[x,Tau]; end
dc=dcgain(GS);
y=opt_fun(x,GS,key,nn,nd,dc);
x=fminsearch('opt_fun',x,[],GS,key,nn,nd,dc);
alph=[1,x(nn+1:nn+nd)]; beta=x(1:nn+1);
if key==0, Td=0; end
beta(nn+1)=alph(end)*dc;
if key==1, Tau=x(end)+Td;
else, Tau=0; end
G_r=tf(beta,alph,'ioDelay',Tau);

⌨️ 快捷键说明

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