How do I get data from each step in a loop?
2 次查看(过去 30 天)
显示 更早的评论
Hello.
I want my array resu to save all date for each n=1,2,3... in row n, and start the same procedure for next n. So in the first row in resu i want to have an array when n=1 while looping m and j. Second row scould be an array when n=2 while looping m and j. And so on, all the way until n=N.
Any suggestions what iam doing wrong?
My code:
resu = zeros([N,length(t)]);
u=zeros(size(t));
for n=1:N
for m=1:N
for j=1:Q
Omega=omegaakse(j);
u=u+abs(Gu(n,m,j))*sqrt(2*domega)*cos(Omega.*t+2*pi*rand);
end
end
resu(n,:) = u;
end
where t i a time vector.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 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!