use the nested loop to calculate the kronecker product for different size

1 次查看(过去 30 天)
A = round((rand(2)*11-5.5)) B = round((rand(3,4)*21-10.5)) calculate the kronecker product of AB

采纳的回答

Sagar Damle
Sagar Damle 2014-4-26
A = round((rand(2)*11-5.5))
B = round((rand(3,4)*21-10.5))
[rA,cA] = size(A);
[rB,cB] = size(B);
finalanswer = [];
for i = 1:rA
answer =[];
for j = 1:cA
temp = A(i,j) * B;
answer = [answer,temp];
end
finalanswer = [finalanswer;answer];
end
finalanswer
z = kron(A,B)
isequal(z,finalanswer)

更多回答(1 个)

Sagar Damle
Sagar Damle 2014-4-26
I think you have not taken much efforts for your problem.'Google' can give you the information which you want.
You have to use the function "kron(A,B)".

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by