Problem 43684. 0, 2, 0, -2, 0, 2, 0, -2, ...
Generate the first n terms of a periodic sequence defined as
f(x) = 0, 2, 0, -2, 0, 2, 0, -2, ..., for x = 1, 2, 3, 4, 5, 6, 7, 8, ...
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers80
Suggested Problems
-
Sum all integers from 1 to 2^n
17384 Solvers
-
Remove the two elements next to NaN value
702 Solvers
-
Set the array elements whose value is 13 to 0
1435 Solvers
-
527 Solvers
-
11274 Solvers
More from this Author28
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!