Info

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

I'm not sure if my code is correct, I think it might have gone to an infinite loop, but there are a lot of iterations like almost half a million.Please have a look at this code because it's been 2 hours,no luck.

1 回表示 (過去 30 日間)
Likhit Pilli
Likhit Pilli 2017 年 11 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
This is the code
N=100; phi is a 10x100 matrix and q is a 10x500 matrix
I got the values of both phi and q and am able to plot them too.
I would be really grateful if you could help me on this one.
for t=1:500
for i=1:N+1
z(t,i)=0;
for j=1:10
z(t,i)=z(t,i)+phi(j,i).*q(j,t);
end
end
end
  3 件のコメント
Likhit Pilli
Likhit Pilli 2017 年 11 月 11 日
I need z ,z is 500x101 matrix but thanks for looking into it. :D I got the result it took upto 4 hours though.God!
Roger Stafford
Roger Stafford 2017 年 11 月 11 日
As I pointed out in my answer, what you are doing is equivalent to matrix multiplication, and Matlab’s matrix multiplication operator, ‘*’, should be much faster.

回答 (1 件)

Roger Stafford
Roger Stafford 2017 年 11 月 11 日
This is what is known as matrix multiplication:
z = (q.)*phi;

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

Community Treasure Hunt

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

Start Hunting!

Translated by