Filter löschen
Filter löschen

Matrix Multiplication with its transpose in the loop

1 Ansicht (letzte 30 Tage)
Mystery Devil
Mystery Devil am 21 Jan. 2017
Beantwortet: Walter Roberson am 22 Jan. 2017
Hi,
Let's say I have a matrix
A = [1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8]
I need to do matrix multiplication i.e. A'*A, but not all the rows and the column at once. For example, I want to multiply the first two column of the matrix first and obtain a result (let's say r1), then column 1, 2 and 3 multiplied with its transpose, obtain the result (let's say r2) and then column 1,2,3, and 4 multiplied with its transpose and the result is r3 and so on. I have to save the result in the matrix, let's say B
B = [r1 0 0 0
r1 r2 0 0
r1 r2 r3 0
.....]
Can anyone help me with this?
Thank you!
  4 Kommentare
Mystery Devil
Mystery Devil am 22 Jan. 2017
Hey John, I know I should use the loop, but that's what I am trying to figure out. I don't know how to loop it
Mystery Devil
Mystery Devil am 22 Jan. 2017
Hi David, please see the below link for full description and how I want the data to be stored:
Thanks a lot!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 22 Jan. 2017
for k=1:size(A,2)
T=A(:, 1:k);
B{k} = T'*T;
end

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by