% Examples for loops
%Example 1
for (i = 1:10)
    disp(i)
end

% Example 2
total = 0;
N = 5;
for (i = 1:N)
    total = total + i;
end
fprintf('N:%d\n', N);
fprintf('Total:%d\n', total);

% Example 3
total2 = sum(1:N)
fprintf('No-loop-tot:%d\n', total2);

% Example 4
for (i = 1:2:10)
    disp(i)
end

% Example 5
for (i = linspace(0, 10, 10))
    disp(i)
end
for (i = linspace(0, 10, 11))
    disp(i)
end
