# Newton Raphson Method – Numerical Root Finding Method in MATLAB

Newton Raphson Method is root finding method of non-linear equation in numerical method. This method is fast than other numerical methods which are use to solve nonlinear equation. The convergence of Newton Raphson method is of order 2. In Newton Raphson method, we have to find the slope of tangent at each iteration that is why it is also called tangent method. This method is an open method, therefore, it does not guarantee to converge. However, there is a theorem exist which give the guarantee to the existence of root of the function. It has require single initial approximation to start the solution using Newton Raphson method. But, the disadvantage of this method is that it require to find the derivative at each iteration and sometimes it become most difficult when function is larger.

At here, we write the code of Newton Raphson Method in MATLAB step by step. MATLAB is easy way to solve complicated problems that are not solve by hand or impossible to solve at page. MATLAB is develop for mathematics, therefore MATLAB is the abbreviation of MATrix LABoratory.

At here, we find the root of the function f(x) = x3+4x2-10 = 0 by using Newton Raphson method with the help of MATLAB.

## MATLAB Code of Newton Raphson Method

``````clear all;
close all;
clc;
f=inline('x^3+4*x^2-10');
df=inline('3*x^2+8*x');
x0=input('Enter initial approximation=');
tol=input('Enter tolerance=');
itr=input('Enter number of iteration=');
p=0;
for i=1:itr
x1=x0-f(x0)/df(x0);
if abs(x1-x0) < tol
p=1;
k=i;
break;
else
x0=x1;
end
end

if p==1
fprintf('Solution is %f at iterations %i',x1,k)
else
fprintf('No convergent solution exist in the given number iteration')
end
``````