Vectorizing a for loop
1 次查看(过去 30 天)
显示 更早的评论
end
I need to vectorize this for loop, but i am having trouble. so far I have this. I do not understand what I am doing wrong. I understand the concept of what I am trying to do, but having trouble applying it.
ni = 8;
k=2:9;
j=[];
y=[];
y(1) = 12 + 6*cos(0);
j =cumsum((k-1)*((20)/ni));
y(k) = 12 + 6*cos(2*pi.*j./20);
any help would be greatly appreciated.
2 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!