matrices multiplication , the description below

조회 수: 1 (최근 30일)
Matthew Worker
Matthew Worker 2021년 6월 27일
댓글: Rena Berman 2021년 12월 16일
% 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
Rik
Rik 2021년 12월 15일
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 2021년 12월 16일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

채택된 답변

Soniya Jain
Soniya Jain 2021년 6월 27일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by