Create a function that produces counting up from 0 up to n then down to 0
n=2 --> 0 1 2 1 0
n=3 --> 0 1 2 3 2 1 0
sweet
clc
a = 0;
z = 1;
n = 10
for b = 1:n;
if z <= n/2;
a = a+1
z = z+1;
elseif z == n;
z = 0;
else
a = a-1;
z = z+1;
end
end
nice!
Make the vector [1 2 3 4 5 6 7 8 9 10]
29462 Solvers
363 Solvers
144 Solvers
214 Solvers
410 Solvers