for loops iterations into array
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Image Analyst
2013-3-7
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!