📄 fpseudo.m
字号:
function [kpc,comden,lamda,cdomi]=fpseudo(w,f,ci,kform,weight)
%FPSEUDO Calculate pseudo-decoupling controller.
% [KPC,Comden]=fpseudo(w,f,ci) returns the ci-th column, KPC, of
% a constant pre-compensator numerator transfer function matrix and
% a common denominator polynomial, Comden. The coefficients of KPC
% are calculated such that F*(KPC(s)/Comden(s)) is approximately a
% multiple of the ci-th unit vector over the frequency range W. F is
% an MVFR matrix of the plant and W is the associated frequency vector.
%
% [KPC,Comden,lamda]=FPSEUDO(W,F,ci) also returns lamda, the min. cost.
% [KPC,Comden,lamda]=FPSEUDO(W,F,ci) also returns the resulting column
% dominance for the ci-th column of the pre-compensated system.
%
% [KPC,Comden,lamda]=FPSEUDO(W,F,ci,KFORM) returns KPC whose elements
% have the orders specified in KFORM.
% E.g. for a system with 3 inputs KFORM of
% [ 1 -2 -2 => row 1 k*s^-2
% 3 -1 0 => row 3 k*s^-1 + k*s^0
% row 2 0
%
% [KPC,Comden,lamda]=FPSEUDO(W,F,ci,KFORM,Weight) applies the weighting,
% Weight(i), at each frequency W(i).
% See also FADJ,FCDOM
% Dr M.P. Ford 2nd September 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
% MRN0019
nargs=nargin;
error(nargchk(3,5,nargs));
[fm,fn]=fsize(w,f);
lw=length(w);
if nargs<4 % form default kform = constants
kform=[(1:fn)',zeros(fn,1)];
end
if nargs<5 % default weight = 1
weight=ones(lw,1);
end
weight=weight(:);
if length(weight)~=lw
error('Number of Weightings must equal the number of frequency points.')
end
% find maximum and minimum power of K
[km,kn]=size(kform);
if kn<2
error('Must have at least 2 columns in kform')
end
if any(kform(:,1)<1)|any(kform(:,1)>fn)
error('Kform row index outside the range of the column indices of F')
end
kmax=max(max(kform(:,2:kn)));
kmin=min(min(kform(:,2:kn)));
kmnvec=kmax:-1:kmin;
kmn=length(kmnvec);
% form K vector of 0's and 1's
kvec=zeros(fn*kmn,1);
for i=1:km
ki=kform(i,1); % row of pre-compensator
for j=2:kn % for each power specified in that row
kj=find(kmnvec==kform(i,j)); % find index of power
kvec((kj-1)*fn+ki)=1;
end % for j
end % for i
disp(' Accumulating the frequency responses.')
[nli,mwi]=pseudint(w,f,kmax,kmin,ci,weight);
% reduce nli and mwi to eliminate the missing terms in kform
nli=nli(kvec,kvec);
mwi=mwi(kvec,kvec);
j=find(kvec==1);
comden=zeros(1,kmn);
comden(kmn)=1;
kpc=zeros(fn,kmn);
k=zeros(fn*kmn,1);
sf=1; % when the minimun singular value is almost zero
% the scale factor effects the result
% a simple serach can be preformed on sf for the
% best lamda if desired
[lamda,k(j)]=pdsolv(nli,mwi,sf);
kpc(:)=k;
if nargout==4 % calculate the resulting column dominance
k=[];
for i=1:fm % form a pre-compensator of the correct size.
k=[k,kpc];
end
k=mv2fr(k,comden,w);
cdomi=fcdom(w,fmulf(w,f,k));
cdomi=cdomi(:,ci); % Pick out the ci column
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -