필터 지우기
필터 지우기

How can i solve this problem ?

조회 수: 4 (최근 30일)
Razi Naji
Razi Naji 2017년 4월 28일
편집: David Goodmanson 2017년 4월 28일
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
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
Razi Naji 2017년 4월 28일
Dear Roger you are right , this method is not converge to all roots , you have to made some modification to get the right iteration form , any way , i could solve this problem with some help from Mr. David :-) , i solved this example before in newton raphson and 'fzero' function but i was trying to solve it in FPI method , any way thanks for your time to answer my question , best regards , Razi

댓글을 달려면 로그인하십시오.

채택된 답변

David Goodmanson
David Goodmanson 2017년 4월 28일
편집: David Goodmanson 2017년 4월 28일
Hello Razi, The problem occurs in the statement
x(i+1) = (3*x(i)+0.5)^(1/3)
The (3x+1/2) part is negative for x < -1/6. When you take that negative quantity to the 1/3 power, you get complex numbers. For whatever reason, iteration eventually ends up at the +1.81 root. If you start with any initial guess x > -1/6, you will converge nicely in terms of real numbers and end up at +1.81.
To find the root at -1.64 you need to plan the iteration in advance. Letting x --> -x gives the iteration
x(i+1) = -(-3*x(i)+0.5)^(1/3) % works for initial guess < -1/6
which converges with real numbers to -1.64.
There is also the third root, at -.17. Right now your iteration essentially solves for x^3 in terms of x and a constant. To get the last root you have to express x in terms of x^3 and a constant and iterate. Depending on your initial guess, this either goes to -.17 or to +-infinity.
  댓글 수: 2
Razi Naji
Razi Naji 2017년 4월 28일
Dear David Thanks for your answer , you are right but your statement also not working , i just did small modification in your statement and it became like this : x(i+1) = - ( -(3 * x(i) + 0.5))^(1/3) , i have added just two Parentheses :-) and i got the root , thank you sooooooo much for your help and for your time , best regards , Razi
David Goodmanson
David Goodmanson 2017년 4월 28일
편집: David Goodmanson 2017년 4월 28일
Hello Razi, you are right, on that line I had intended to put
x(i+1) = -(-3*x(i)-0.5)^(1/3)
but I didn't. Thanks for catching the error.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Newton-Raphson Method에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by