init_ub_lb.m
来自「内模控制器(IMC)工具箱。包括参数整定、PID控制器参数转换等」· M 代码 · 共 77 行
M
77 行
function [Xwc_ub_w,Xwc_lb_w]=init_ublb(decade,numpdec,vub,maxrow,maxcol)
% This function initializes the upper and lower bound table to
% assure the correct dimension and initialvalues.
global Xwc_ub_w Xwc_lb_w
npoints=round((decade(2)-decade(1))*numpdec);
refreq=[10^decade(1) 10^decade(2)];
freq=logspace(decade(1),decade(2),npoints);
freq_ln=length(freq);
% initialize the upper bound table
do_not_pass=0;
[temp,temp1]=size(Xwc_ub_w);
if all([temp,temp1]==[maxrow, maxcol])
if ~isempty(Xwc_ub_w{1,1})
[n,m]=size(Xwc_ub_w{1,1});
if m ~= length(vub)+2 % number of uncertainty parameters inconsistent
do_not_pass=1;
end
if n < freq_ln % Less frequency points than required
do_not_pass=1;
end
tmp=min([freq_ln n]);
tmp1=length(find(Xwc_ub_w{1,1}(1:tmp,2)'==freq(1:tmp)));
if tmp1/tmp < 0.1 % the frequency points do not aline correctly.
do_not_pass=1;
end
else
do_not_pass=1;
end
else
do_not_pass=1;
end
if do_not_pass
for i=1:maxrow
for j=1:maxcol
Xwc_ub_w{i,j}=[zeros(freq_ln,1) freq' zeros(freq_ln,length(vub))];
end
end
end
% initialize the lower bound table
do_not_pass=0;
[temp,temp1]=size(Xwc_lb_w);
if all([temp,temp1]==[maxrow, maxcol])
if ~isempty(Xwc_lb_w{1,1})
[n,m]=size(Xwc_lb_w{1,1});
if m ~= length(vub)+2 % number of uncertainty parameters inconsistent
do_not_pass=1;
end
if n < freq_ln % Less frequency points than required
do_not_pass=1;
end
tmp=min([freq_ln n]);
tmp1=length(find(Xwc_lb_w{1,1}(1:tmp,2)'==freq(1:tmp)));
if tmp1/tmp < 0.1 % the frequency points do not aline correctly.
do_not_pass=1;
end
else
do_not_pass=1;
end
else
do_not_pass=1;
end
if do_not_pass
for i=1:maxrow
for j=1:maxcol
Xwc_lb_w{i,j}=[ones(freq_ln,1) freq' zeros(freq_ln,length(vub))];
end
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?