Multiplication between matrices with different dimensions

조회 수: 3 (최근 30일)
stelios loizidis
stelios loizidis 2021년 1월 12일
답변: Doddy Kastanya 2021년 1월 12일
Hello. I have the following issue: I have the matrix H which has a size of 353X25. Next I calculate the pseudo-inverse H_inv (25X353). I multiply the H_inv matrix by the matrix Data which has size 353Χ24. However, the interations cannot be continued because the result obtained from the multiplication (Res matrix) of the H_inv and Data is a 25x24 matrix. How can this problem be solved so that the Res matrix has all the results emerges. That is, to have dimensions: 8472X24? Your help is important.
Below is the code:
for w=1:353
H_inv(i,:)=pinv(H(i,:)); % H-(353X25)
Res(i,:)=H_inv*Data(i,:); %w=1 Res(25X24)
end

답변 (1개)

Doddy Kastanya
Doddy Kastanya 2021년 1월 12일
Your loop is in terms of "w"; however, in the loop "w" is not used at all. Shouldn't "i" be "w"?
The pseudoinverse matrix can be executed on the whole matrix instead of just on each row of the matrix. So, why don't you just use H_inv=pinv(H)? Finally, given the size of the H_inv and Data, the Res matrix should have a size of 25x24 instead of 8472x24.

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by