Problem 2010. Wrap a vector, but insert NaN's at the wrap-positions.
When you plot a line that wraps, and do not want the sawtooth shape to show up in the plot, you can either draw all separate lines, or you can insert NaN's between the segments. The plot command does not draw a line between NaN's.
This assignment is to create a function that wraps a vector, and inserts NaN's where it wraps.
The modulo of the wrapping range is explicitly entered into the function.
For example, if we wrap a vector [1:20] at 3, this will result in [1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2 nan 0 1 2].
As (almost) always, regexp and eval are not appreciated.
Solution CommentsShow comments
Problem Recent Solvers20