Solving Problems Using Array Functions Matlab