matrices multiplication , the description below

2 visualizaciones (últimos 30 días)
Matthew Worker
Matthew Worker el 27 de Jun. de 2021
Comentada: Rena Berman el 16 de Dic. de 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 comentarios
Rik
Rik el 15 de Dic. de 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 el 16 de Dic. de 2021
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuesta aceptada

Soniya Jain
Soniya Jain el 27 de Jun. de 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.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by