Maybe something like this would work for you:

Code:function [x err iter] = mhfSecant(f,x1,x2) maxerr = 1e-6; maxiter = 100; iter = 0; while abs(x1-x2) > maxerr && iter < maxiter xnew = x2-(x2-x1)/(f(x2)-f(x1))*f(x2); x1 = x2; x2 = xnew; iter = iter +1; end x = (x1+x2)/2; err = f(x);Im not very familiar with this method so I cant guarantee this is the right solution.Code:EDU>> f=@(x) ((x)^4-1); EDU>> [x e i] = mhfSecant(f,1.5,1.3) x = 1.0000 e = 6.9803e-009 i = 7 EDU>>

Regards Elbarto