Newton's method
古いコメントを表示
URGENT HELP!!
"Write a matlab program to calculate R^(1/3), for all R >0 with a use of iterative Newton method. Examine graphically the chosen function f, in order to check for which points this method will converge."
This is my code, but I think it's not correct:
x = linspace(0,10)
f=@(x) x^(1/3);
df=@(x) (1/3)*x^(-2/3);
n=10; %number of iterations
for i=2:n
x(i)=x(i-1)-f(x(i-1))/df(x(i-1));
end
2 件のコメント
Torsten
2022 年 6 月 12 日
Hint: In Newton's method, take
f(x) = x^3 - R
as the function.
If you need to find R^(1/3) and the value of R is given, then why do you create a function x^(1/3)? Is R a variable, something like the user input?
The rhetorical question.
If you want to find R^(1/3) = x, which is x exactly, then you can make both sides
[R^(1/3)]^3 = x^3
R = x^3
Now, this is a cubic equation. You can solve the polynomial problem.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Systems of Nonlinear Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!