for loops iterations into array
3 views (last 30 days)
Show older comments
For every K value i want to put it in a vector with 12 columns (due to the 12 iterations of i) then end that and go to the next k which is 1 and go to the next i iteration which is from 1:12. Then i wanna do the same thing with this for loop and store this values as K_2. what i am trying to implement is a non recursive phasor estimate.
for k = 0:5
for i = 0+k:11+k
K( =(sqrt(2)/N)*(100*cos(i*Theta + (pi/4 + (k*Theta)).*exp(-j*i*Theta)))
X_N(k+1,:) = [K]
end
end
Thanks before hand
0 Comments
Answers (2)
Image Analyst
on 7 Mar 2013
Perhaps this?
N = 3; % Whatever...
Theta = pi/42; % Whatever...
X_N = zeros(6, 12); % Initialize
for k = 0:5
i = k:(11+k);
K =(sqrt(2)/N)*(100*cos(i*Theta + (pi/4 + (k*Theta)).*exp(-j*i*Theta)));
X_N(k+1,:) = K;
end
0 Comments
See Also
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!