how to find x using Newton Raphson in matlab

2 ビュー (過去 30 日間)
Nusaiba Khaam
Nusaiba Khaam 2013 年 11 月 5 日
編集済み: Ayush Kumar Jaiswal 2022 年 6 月 19 日
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

回答 (1 件)

Ayush Kumar Jaiswal
Ayush Kumar Jaiswal 2022 年 6 月 19 日
編集済み: Ayush Kumar Jaiswal 2022 年 6 月 19 日
% give initial guess
x(1)=initial_guess;
% specify number of iterations
num_itr = 5;
for i=1:length(num_itr)
f(i)=8*e^-x(i)*sin(x(i))-1;
df(i)=-8*e^(-x(i) sin (x(i))) (x(i) cos(x(i)) + sin(x(i)));
x(i+1)=x(i)-(f(i)/df(i));
end
x(end);

カテゴリ

Help Center および File ExchangeNewton-Raphson Method についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by