Vectorisation of a loop
1 view (last 30 days)
Show older comments
Is it possible to vectorise this loop? Any help would be greatly appreciated.
% Calculate X(k)
for k = 1:length(T)
X(k) = (sum(Vx(1:k-1).*diff(T(1:k))))+ X1;
end
% Calculate Y(k)
for k = 1:length(T)
Y(k) = (sum(Vy(1:k-1).*diff(T(1:k))))+ Y1;
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!