Professional Documents
Culture Documents
function y=secant(fun,x0,x1,tol)
u=subs(fun,x0);
v=subs(fun,x1);
while abs(v)>tol
p=x1-v*(x0-x1)/u-v;
x1=p
v=subs(fun,p);
end
p
COMPILAMOS:
NUMERO DE ITERACIONES n:
function y=secant(fun,x0,x1,tol)
u=subs(fun,x0);
v=subs(fun,x1);
n=2
while abs(v)>tol
p=x1-v*(x0-x1)/(u-v);
x1=p
v=subs(fun,p);
n=n+1
end
p
n
COMPILAMOS:
format long