matrices multiplication , the description below

2 views (last 30 days)
% 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 Comments
Rik
Rik on 15 Dec 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

Sign in to comment.

Accepted Answer

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

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!