Originally Posted by

**chronicals** i have a function: f ( h ) = (0,0226 / h^2) + h - 0.5879

Using fixed point iteration determine h within 0,1 % relative error.

I modified h= g(h) = 0.5879 - (0,0226 / h^2)

Then how can i write these functions' fixed point iteration m-file. Can anybody write a example m-file for this kind of problems?

The following script will implement this fixed point iteration but you will need to sort out the stopping condition yourself.

Code:

h=1;
err=1;
while abs(err/h)>0.001
h1=0.5879-0.0226/h^2;
err=abs(h-h1);
h=h1
end
h

CB