Working model of the exercise. Some problems with the last values of N. Next step; fix these issues and learn to plot.