MATLAB Answers

error to get the answer by Kronecker

3 views (last 30 days)
Mariam Gasra
Mariam Gasra on 1 May 2019
Commented: imrankhan ajees on 1 May 2019
function K = kronecker(A,B)
if ~issparse(A) && ~issparse(B)
if ~ismatrix(A) || ~ismatrix(B)
error('kronecker:TwoDInput','Inputs must be 2-D.');
end
% Both inputs are full, result is full. This is faster than
% MATLAB stock kron (indexing based)
[ma, na] = size(A);
[mb, nb] = size(B);
A = reshape(A,[1 ma 1 na]);
B = reshape(B,[mb 1 nb 1]);
K = bsxfun(@times,A,B);
K = reshape(K,[ma*mb na*nb]);
else % One of the input matrix is sparse
% Call MATLAB stock KRON
K = kron(A,B);
end
how can i solve the error ?
  6 Comments
imrankhan ajees
imrankhan ajees on 1 May 2019
copy the content on the command window after getting the error and post it otherwise we can't help you

Sign in to comment.

Answers (0)

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by