krons.m
来自「剑桥大学用于线性和双线性动力学系统辨识的工具箱」· M 代码 · 共 53 行
M
53 行
function Y = krons(U,i,m)%KRONS Assembles U++ for use in the Bilinear Identification Toolbox.%% KRONS(U,i,m) returns U^{++}_{i-1|0}. U should be a block Hankel matrix,% i>0 an integer and m the number of inputs of the system.%% See also BILINID, BLOCIOBI, BLOCPLBI, BLOCHANK, KHATRI.%% CUED System Identification Toolbox.% Cambridge University Engineering Department.% Copyright (C) 1998-2002. All Rights Reserved.% Version 1.00, Date: 01/06/2002% Created by H. Chen and E.C. Kerrigan.% Old code%ColU = size(U,2);%Y = zeros(m*(m+1)/2,ColU);%for k=1:m% Y((k-1)*m+1:(k-1)*m+m-k+1,:) = khatri(U(k,:),U(k:m,:));%end %%if i > 1% for j = 1:i-1% Yp = khatri(U(j*m+1:(j+1)*m,:),Y);% Y = [Y; Yp];% end%end% More efficient code - avoids unneccesary dynamic memory allocation. See% the Matlab User's Guide on efficient memory management.Y = zeros(m/2*(m+1)^i,size(U,2)); % preallocate just enough memoryp = 1; % set counterfor k=1:m q = m-k+1; % number of rows in khatri(U(k,:),U(k:m,:)) Y(p:p+q-1,:) = khatri(U(k,:),U(k:m,:)); p = p+q; % update counterend if i > 1 A = zeros(m/2*(m+1)^(i-1),size(U,2)); % preallocate just enough memory for j = 1:i-1 A(1:p-1,:) = Y(1:p-1,:); % avoid dynamic memory allocation q = m*(p-1); % number of rows in khatri(U(j*m+1:(j+1)*m,:),A(1:p-1,:)) Y(p:p+q-1,:) = khatri(U(j*m+1:(j+1)*m,:),A(1:p-1,:)); p = p+q; % update counter endend% *** last line of krons.m ***
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?