Loops and Complicated Matrix Multiplication
古いコメントを表示
Hello,
This may be simple to figure out but for some reason I can't seem to get the results I want.
I'm trying to multiply two matrices together using a loop, in which the matrix dimensions do not agree. I know this impossible to do using the standard matrix arithmetic. What I would like to do is multiply each column from matrix (Txcouple 41x40x40) against a page in the other matrix (dpTxcouple1 41x17x1600). There should be 1600 pages in the resulting answer but I am unsure how to do this. Here is what I have so far. I can manage to populate the first page with the correct result, but the other pages are filled with zeros.
for k=1:40;
for m=1:17
for g=1:40;
for i=(f-1) * 40 + g;
Tx1Final(:,m,i)=Txcouple(:,k,g).*dpTxcouple1(:,m,i);
end
end
end
end
Any help would be greatly appreciated.
Thanks!
Josh
採用された回答
その他の回答 (1 件)
Azzi Abdelmalek
2012 年 9 月 5 日
編集済み: Azzi Abdelmalek
2012 年 9 月 5 日
[n,m,l]=size(A);[n1,m1,l1]=size(B);v=[];
for i1=1:l
for k=1:m
v=[v bsxfun(@times, A(:,i1,k),B)];
end
end
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!