final code and plots for course project 2
added comments to code