📄 fssv.m
字号:
function [mu,dd,nsteps,fails,grad] = fssv(w,f,k,d,max,tol,verbose)
%FSSV Structured singular value (from MIMO frequency response).
% [mu,dd,nsteps,fails,grad] = fssv(w,f,k,d,max,tol,verbose)
% mu = fssv(w,f,k)
% Calculates the Structured Singular Value (mu) of an MVFR matrix.
% Block perturbations are allowed, but not correlated.
% Input arguments:
% w frequency vector
% f square MVFR matrix whose SSV is to be computed, n x n.
% k vector of m block sizes,such that sum(k) == n
% (Default: ones(1,n))
% d vector of m initial scaling numbers. (Default: ones(1,m))
% max maximum number of hill-climbing steps at each frequency
% (Default: 100)
% tol convergence criterion at each frequency (Default: 1e-6)
% verbose 1 if diagnostic information to be output, 0 otherwise.
% (Default: 1)
% Output arguments:
% mu column vector holding upper bounds for the SSV
% dd MVFR matrix, each row holding optimal scaling at one frequency
% nsteps column vector holding number of steps taken at each frequency
% fails row vector holding indices of frequencies at which
% convergence was not obtained.
% grad MVFR matrix, each row holding final gradient at each frequency
% Copyright (C) 1989 by Cambridge Control Ltd.
% Written by J.M.Maciejowski, 10.8.1989. Corrected 7.9.89.
%%%%% Check input arguments and assign defaults:
nargchk(nargin,2,7);
[nout,nin] = fsize(w,f);
if nout ~= nin,
error('Input MVFR matrix must have equal numbers of inputs and outputs')
end;
if nargin < 7, verbose = 1; end;
if nargin < 6, tol = 1e-6; end;
if nargin < 5, max = 100; end;
if nargin < 4,
if nargin < 3, k = ones(1,nin); end;
d = ones(1,length(k));
end;
if any(k<1), error('Block sizes must be positive integers'); end;
if sum(k)~=nin, error('Sum of block sizes must equal number of inputs'); end;
if length(d)~=length(k),
error('Vectors k and d must have the same length');
end;
if any(d==0), error('Zero elements not allowed in d vector'); end;
%%%%% End of input argument checks
%
if verbose,
disp('FSSV: Freq Mu Nsteps To do');
end;
%
%%%%% Find good initial scaling for first frequency:
k = k(:)'; d = d(:)'; % Ensure k and d are row vectors
if size(d)==[1,length(k)],
if d == ones(1,length(k)), % Only if default initial scalings
if size(k) == [1,nin],
if k == ones(1,nin), % Scalar blocks only
[vp,lp,rp] = fperron(w(1),fgetf(w,f,1));
d = lp; % Initial scaling
end;
end;
end;
end;
%%%%% End of initial scaling
%
mu=[]; dd=[]; nsteps=[]; grad=[];
%
%%%%% Find mu for each frequency:
lw = length(w);
for i = 1:lw,
fi = fgetf(w,f,i);
[mui,d,nsi,gradi] = ssv(fi,k,d,max,tol,0);
mu=[mu;mui]; dd=[dd;d']; nsteps=[nsteps;nsi]; grad=[grad;gradi'];
if verbose,
fprintf(' %-10.3e %-10.3e %3.0f',w(i),mui,nsi);
fprintf(' %3.0f\n',lw-i);
if nsi==max,
disp('***** Not converged at this frequency *****');
end;
end;
end;
%%%%% End of looping through frequencies
%
%%%%% Find failures:
fails = find(nsteps==max)';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -