K = kron(A,B) returns
the Kronecker
tensor product of matrices A and B.
If A is an m-by-n matrix
and B is a p-by-q matrix,
then kron(A,B) is an m*p-by-n*q matrix
formed by taking all possible products between the elements of A and
the matrix B.

This example visualizes a sparse Laplacian operator matrix.

The matrix representation of the discrete Laplacian operator on a two-dimensional, n-by- n grid is a n*n-by- n*n sparse matrix. There are at most five nonzero elements in each row or column. You can generate the matrix as the Kronecker product of one-dimensional difference operators. In this example n = 5.

n = 5;
I = speye(n,n);
E = sparse(2:n,1:n-1,1,n,n);
D = E+E'-2*I;
A = kron(D,I)+kron(I,D);

Input matrices, specified as scalars, vectors, or matrices.
If either A or B is sparse,
then kron multiplies only nonzero elements and
the result is also sparse.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical Complex Number Support: Yes

If A is an m-by-n matrix
and B is a p-by-q matrix,
then the Kronecker tensor product of A and B is
a large matrix formed by multiplying B by each
element of A