newtons method with matlab code with function plotting