Update exercise_a.m

using matlab-specific features such as matrix operations