How do I get data from each step in a loop?

3 views (last 30 days)
Andre
Andre on 18 Apr 2013
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.

Answers (0)

Categories

Find more on Loops and Conditional Statements 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!