numerical method HW using matlab with resdiual error