khatri.m

来自「剑桥大学用于线性和双线性动力学系统辨识的工具箱」· M 代码 · 共 32 行

M
32
字号
function Y = khatri(A,B)%KHATRI   Khatri-Rao product.  %%   KHATRI(X,Y) is the Khatri-Rao product of X and Y.  The result is a large%   matrix formed by taking Kronecker tensor products between the respective%   columns of X and Y. For example, if X and Y have N columns each, then%   KHATRI(X,Y) is given by%%      [ kron(X(:,1),Y(:,1)) kron(X(:,2),Y(:,2)) ... kron(X(:,N),Y(:,N)) ]%%   See also KRON.%% 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.[RowA,ColA] = size(A);[RowB,ColB] = size(B);if ColA ~= ColB   error('The columns of two input matrices have to be same.')end	Y = zeros(RowA*RowB,ColA); % preallocate just enough memoryfor i = 1:ColA  Y(:,i) = kron(A(:,i),B(:,i));end% *** last line of khatri.m ***

⌨️ 快捷键说明

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