matrices multiplication , the description below

2 vues (au cours des 30 derniers jours)
Matthew Worker
Matthew Worker le 27 Juin 2021
Commenté : Rena Berman le 16 Déc 2021
% W,H values is for example .. They can be with any dimension but always the number of rows of H is equal to the number of columns of W and the matrices are not squared .
% when i=1 ... Alfa_1 is the multiplication between the first row of H and the first column of W and Alfa _2 is the sum of multiplying the other rows and columns except for the multiplication between the first row of H and the first column of W
% when i=2 ... Alfa_1 is the between the second row of H and the second column of W and Alfa _2 is the sum of multiplying the other rows and columns except for the multiplication between the second row of H and the second column of W.
And goes like this to the end of iterations, also (k) is equal to the number of rows of H and the number of columns of W
H=[1 2 2 1 ; 3 1 1 2;1 3 2 4]
W=[4 1 2 ;1 3 2 ;2 1 3;2 1 4]
for i=1:k
Alfa_1 = H(i,:)*W(:,i);
Alfa_2 = ........
end
  3 commentaires
Rik
Rik le 15 Déc 2021
matrices multiplication , the description below
% W,H values is for example .. They can be with any dimension but always the number of rows of H is equal to the number of columns of W and the matrices are not squared .
% when i=1 ... Alfa_1 is the multiplication between the first row of H and the first column of W and Alfa _2 is the sum of multiplying the other rows and columns except for the multiplication between the first row of H and the first column of W
% when i=2 ... Alfa_1 is the between the second row of H and the second column of W and Alfa _2 is the sum of multiplying the other rows and columns except for the multiplication between the second row of H and the second column of W.
And goes like this to the end of iterations, also (k) is equal to the number of rows of H and the number of columns of W
H=[1 2 2 1 ; 3 1 1 2;1 3 2 4]
W=[4 1 2 ;1 3 2 ;2 1 3;2 1 4]
for i=1:k
Alfa_1 = H(i,:)*W(:,i);
Alfa_2 = ........
end
Rena Berman
Rena Berman le 16 Déc 2021
(Answers Dev) Restored edit

Connectez-vous pour commenter.

Réponse acceptée

Soniya Jain
Soniya Jain le 27 Juin 2021
I consider you want to find Alfa_1 and Alfa_2 at each iteration, so you can modify the above code as,
H=[1 2 2 1 ; 3 1 1 2;1 3 2 4];
W=[4 1 2 ;1 3 2 ;2 1 3;2 1 4];
[k,l]=size(H);
for i=1:k
Alfa_1(i) = H(i,:)*W(:,i);
Alfa_2(i) = 0;
for j=1:k
Alfa_2(i) = Alfa_2(i) + H(i,:)*W(:,j);
end
Alfa_2(i) = Alfa_2(i) - Alfa_1(i);
end
Alfa_1 and Alfa_2 are the arrays which contains value of each iteration.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by