matlab code for task