Multiplication between matrices with different dimensions

4 views (last 30 days)
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

Answers (1)

Doddy Kastanya
Doddy Kastanya on 12 Jan 2021
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.

Categories

Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!