?? khatri.m
字號:
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -