I was wondering whether there is a smart and efficient way in Matlab to compute the kronecker product of several 1D arrays.
What I mean is something like this
A = [a1, a2]; B = [b1, b2]; C = [c1, c2]; K = f(A,B,C) = [a1*b1*c1, a1*b1*c2, a1*b2*c1, ... ]
One possible way it is to use the kron(X,Y) function, but it has to be put inside a loop to obtain the aforementioned result since the kron function accepts only 2 arguments per time.
K = 1; tot_arrays = [A, B, C]; for i=1:num_arrays K = kron(K,tot_arrays(:,i)); end
Isn't there a smarter and more efficient way to obtain the same result for the kron multiplication of more than 2 arrays per time?