How can i solve this problem ?
古いコメントを表示
I am trying to find the roots of the equation f(x) = 2x^3 - 6x - 1 = 0 Numerically by using FPI ( Fixed - Point - Iteration ) Method with Matlab , the first root is x = -1.641783527 and the 2nd root is x = 1.810037929 , the iteration form for this equation which make it converge to the 1st root is g(x) = (3*x + 0.5 )^(1/3) , i have took the initial value for the 1st root as x = -1.8 , after running the program i do not know why the Matlab leave the 1st root and jump to the 2nd root ? i could not find any logical reason for that ? could any one help me to find where is the problem ? the code of the program is :
clear ; clc ; close all x(1) = -1.8 ; n = 50 ; r = -1.641783527 ; for i=1:n x(i+1) = (3*x(i)+0.5)^(1/3) ; if ( abs(x(i+1) - r )>0.5e-8) x(i) = x(i+1) ; root = x ; iteration(i) = i ; error = abs(root-r); else end end root=root(:) , iteration=iteration(:) , error=error(:) plot(x,'*') , grid xlabel('iteration : n') ylabel('root')
2 件のコメント
Roger Stafford
2017 年 4 月 28 日
The “fixed point iteration” method you used is by no means a reliable method for finding roots. It might succeed - it might not. Also in cases where there is more than one root, such as yours, there is no telling which root an initial estimate will eventually lead to (if any.)
My recommendation is to use a superior algorithm such as the newton-raphson or the bisection methods. Also with matlab you can use the ‘fzero’ function.
Razi Naji
2017 年 4 月 28 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!