Professional Documents
Culture Documents
Cod Ejercicos 2.50
Cod Ejercicos 2.50
1:3;
y=exp(x)+0.435*(exp(x)-1)/x-1.546;
plot(x,y)
hold on
plot(x,0*x)
grid on
title('F(x)=exp(x)+0.435*(exp(x)-1)/x-1.546')
xlabel(x)
ylabel(y)
hold off
a=-0.12
b=-0.1
tol=0.001
f=inline('exp(x)+0.435*(exp(x)-1)/x-1.546')
error=50;
disp(' c mep')
while(error>tol)
c=(a*f(b)-b*f(a))/(f(b)-f(a));
ERROR=abs(f(c));
if f(a)*f(c)<0
b=c;
else
a=c;
end
end