how to find x using Newton Raphson in matlab

1 view (last 30 days)
How can i get the final value of x using Newton Raphson method in MATLAB i) f(x) = 8e^-xsin(x)-1 ii) f(x) = e^-x(x^2-5x+2)-3
the program should print the final x value obtained along with the true and approximate errors

Answers (1)

Ayush Kumar Jaiswal
Ayush Kumar Jaiswal on 19 Jun 2022
Edited: Ayush Kumar Jaiswal on 19 Jun 2022
% give initial guess
% specify number of iterations
num_itr = 5;
for i=1:length(num_itr)
df(i)=-8*e^(-x(i) sin (x(i))) (x(i) cos(x(i)) + sin(x(i)));

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by