refactoring (week 8, task 1) get rid of unnessasary loop, use octave's built-in norm() function