homework completed in matlab