フィルターのクリア

Finding the roots of equation by newton-raphson method?

1 回表示 (過去 30 日間)
Asli
Asli 2022 年 1 月 13 日
回答済み: Ibrahim Mohammed Wajid 2022 年 7 月 5 日
Write a MATLAB program which utilizes Newton-Raphson method to determine the smallest positive root of the following function:
x^3 – e ^-x = 0.5
i did this but the answer is wrong.. could you please help me about the wrong step?
this is my answer;
x(1)=0;
i=1;
for i=i+1
f(i)=x(i)^3-exp(-x(i))-0.5;
df(i)=3*x(i)^2+exp(-x(i));
x(i+1)=x(i)-(f(i)/df(i));
end
disp(x(end))
  4 件のコメント
James Tursa
James Tursa 2022 年 1 月 13 日
x(1)=0 is simply your starting guess which you can choose. From the wording of the assignment you posted it looks like you can pick this yourself.
Asli
Asli 2022 年 1 月 13 日
thank you so much!!! its much clear now

サインインしてコメントする。

回答 (1 件)

Ibrahim Mohammed Wajid
Ibrahim Mohammed Wajid 2022 年 7 月 5 日
In your code, the for loop is not exactly a loop. It is confined only for one value i = 2.
You can update for i = i + 1 to for i = 1:100 (say) so that your for loop runs for 100 times.

カテゴリ

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