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

📄 uy2h.m

📁 A Matlab toolbox for exact linear time-invariant system identification is presented. The emphasis is
💻 M
字号:
% UY2H - From data to impulse response. (Recursive algorithm)%% [h, delta] = uy2h(u, y, lmax, l, delta)%% U,Y - input (TxM matrix) and output (TxP matrix)% LMAX  - upper bound for the system lag% L     - optional number of samples in a computed block% DELTA - optional desired length of the impulse response %   If skipped the response is computed till %   ||H(delta)||_F > EPS.% H - first DELTA samples of the impulse response%   for MIMO (M-inputs, P-outputs) system, h is PxMxT%   for SISO system, h can be Tx1 vectorfunction [h,delta] = uy2h(u,y,lmax,l,delta)% ConstantsEPS  = 1e-5;IMAX = 100;[T,m] = size(u);p = size(y,2);% Check inputsif (nargin < 3)  error('Not enough input arguments');endif (nargin < 4 | isempty(l))  l = lmax;endL = lmax + l; % # of rows in the Hankel matrixif (nargin < 5 | isempty(delta))  find_delta = 1;  delta = IMAX; else  find_delta = 0;end% Needed in the iterative computationr = triu(qr([blkhank(u,L);blkhank(y,L)]'))';in  = 1:L*m+lmax*p;r11 = r(in,in);r21 = r(in(end)+1:end,in);pinvUY1 = pinv(r11);Y2      = r21;% Initializationfu = zeros(L*m,m); fu(lmax*m+1:(lmax+1)*m,:) = eye(m);fy = zeros(L*p,m);% Iterationimax = ceil(delta/l);h = zeros(p*l*imax,m);for i = 1:imax    % Solve the system  g = pinvUY1 * [fu;fy(1:lmax*p,:)];  fy(lmax*p+1:end,:) = Y2 * g;  % Store the result  h((i-1)*p*l+1:i*p*l,:) = fy(lmax*p+1:end,:);    % Check exit condition if delta is not given  if find_delta     if ( i*l*min(m,p) > 2*lmax & ...         norm(fy(lmax*p+1:end,:),'fro') < EPS)      delta = i*l;      break;    end  end  % Shift for the next iteration  fu(1:m*l,:) = [];   fu = [fu; zeros(m*l,m)];  fy(1:p*l,:) = [];   fy = [fy; zeros(p*l,m)];end if ( m > 1 | p > 1 ) % MIMO  % Construct a 3d output array  h_ = h;  h = zeros(p,m,delta);  for i = 1:delta    h(:,:,i) = h_((i-1)*p+1:i*p,:);  endelse % SISO  h = h(1:delta,:);end

⌨️ 快捷键说明

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