MATLAB Functions | Help Desk |
kron
Kronecker tensor product
K =
kron(X,Y)
K = kron(X,Y)
returns the Kronecker tensor product of X
and Y
. The result is a large array formed by taking all possible products between the elements of X
and those of Y
. If X
is m
-by-n
and Y
is p
-by-q
, then kron(X,Y)
is m
*p
-by-n
*q
.
If X
is 2-by-3, then kron(X,Y)
is
[The matrix representation of the discrete Laplacian operator on a two-dimensional,X(1,1)*Y
X(1,2)*Y
X(1,3)*Y
X(2,1)*Y
X(2,2)*Y
X(2,3)*Y
]
n
-by-n
grid is a n^2
-by-n^2
sparse matrix. There are at most five nonzero elements in each row or column. The matrix can be generated as the Kronecker product of one-dimensional difference operators with these statements:
Plotting this with theI
=
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);
spy
function for n = 5
yields: