Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Can some solve this without for loops ?

1 回表示 (過去 30 日間)
Amelos
Amelos 2016 年 6 月 21 日
コメント済み: Amelos 2016 年 6 月 21 日
a =rand(2,2,3); b = [ 1 2 3]; c = [1 2 3 4 5]; for n = 1: size(a,1) for m = 1:size(a,2) for s = 1: length(b) for k = 1: length(c) L(n,m,s,k)= a(n,m,s) +b(s)*a(n,m,s)*exp(c(k)*b(s)); end end end end
  2 件のコメント
John D'Errico
John D'Errico 2016 年 6 月 21 日
編集済み: John D'Errico 2016 年 6 月 21 日
Given that you got an answer the last time you asked this question, and you accepted that answer, then why repost it? It seems you are asking essentially the same question repeatedly.
Amelos
Amelos 2016 年 6 月 21 日
I want to understand the approach. It is not the same. I changed the dimension of the matrix "a" (2->3). I solved in this way but I dont get the same answer: tmp = bsxfun(@times,reshape(b,1,1,[]),reshape(c,1,1,1,[])); tmp = bsxfun(@times,reshape(a,1,[]),exp(tmp)); tmp = bsxfun(@times,reshape(b,1,1,[]),tmp); tmp = bsxfun(@plus,reshape(a,1,[]),tmp);
Cheers

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by