Help me with this error ?

2 vues (au cours des 30 derniers jours)
Nguyen Trong Nhan
Nguyen Trong Nhan le 29 Juin 2014
I downloaded this file from file exchange (fixedpoint iteration method find approximate root of nonlinear equation). But I don't understand why it have this error(the success variable). Help me to fix it ? . thanks very much.

Réponses (1)

Star Strider
Star Strider le 29 Juin 2014
There seems to be a logic problem in the fixedpoint function.
I don’t usually suggest altering others’ code, but it might be worthwhile to experiment by inserting between these lines:
P0 = p0;
% STEP 1
the line:
success = false;
so that it reads:
P0 = p0;
success = false;
% STEP 1
I cannot guarantee that it will find the real root of your function, since I haven’t run the fixedpoint function or your code with it.
When I used the core MATLAB function roots on your polynomial:
r = roots([1 2 0 -5])
it had one real negative root and two complex roots:
r =
-1.6209e+000 + 1.1826e+000i
-1.6209e+000 - 1.1826e+000i
1.2419e+000 + i

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by