MATLAB Looping
MATLAB supports two looping constructs: for blocks and while blocks.
Contents
For Blocks
Building off this example:
syms t;
% Position functions.
x(t) = cos(t);
y(t) = -sin(t);
z(t) = t^2;
% Tangent functions.
xprime(t) = -sin(t);
yprime(t) = -cos(t);
zprime(t) = 2*t;
figure;
hold on;
for i=1:length(times)
quiver3(x(i),y(i),z(i), xprime(i),yprime(i),zprime(i));
end
hold off;