HW1Q6 code

Wrote matlab code for Q6