Answers for "newton raphson method program in matlab c++"

0

matlab code for newton raphson method

% Program Code of Newton-Raphson Method in MATLAB 
 
a=input('Enter the function in the form of variable x:','s');
x(1)=input('Enter Initial Guess:');
error=input('Enter allowed Error:');
f=inline(a)
dif=diff(sym(a));
d=inline(dif);
for i=1:100
x(i+1)=x(i)-((f(x(i))/d(x(i))));
err(i)=abs((x(i+1)-x(i))/x(i));
if err(i)<error
break
end
end
root=x(i)
Posted by: Guest on March-05-2021
1

newton raphson method program in matlab c++

//Newton Raphson formula
x = x0 - f(x) / derivative(x);
Posted by: coder on August-19-2022

Browse Popular Code Answers by Language