# fixed-point iteration for root finding

5 vues (au cours des 30 derniers jours)
libin danial le 27 Juil 2012
Write a program that uses fixed-point iteration to find the non-zero root of f(x) = x3/2 – x2 + x. Make sure you choose an iteration function, g(x), that will converge for a reasonably good initial guess.
clc, clear all, close all
%define the perimeters
x=[1;10];
for i=1:10
F=x.^(3/2)-x.^2+x;
j=(3/2)*x.^(1/2)-2*x+1;
x=x-j\F
end
this is what i have so far
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Walter Roberson le 27 Juil 2012
You seem to have forgotten to ask a question ?
Also, your code does not appear to have any g(x) function as required in the assignment ?

Connectez-vous pour commenter.

### Réponses (1)

Sargondjani le 27 Juil 2012
a while loop might be a good idea:
err_lim = 1e-6;
x_new = %initial guess
err = err_lim *2; %arbitrary to pass while statement;
while err >= err_lim;
x_old = x_new;
.... computations
x_new = x_old - j\F;
err = %abs(F(x_new));
end
i defined the error as the difference from 0, but you could also include a criterium for the change in x, for example.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Fixed Point dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by