Académique Documents
Professionnel Documents
Culture Documents
function y=fun(x)
y=x*cos(x)-2*x.^2+3*x-1;
%metodos numéricos
%METODO DE BISECCION
%30 - 10 -2008
resp='S';
while(resp=='S'|resp=='s')
clc;
fprintf('\n\t\tMETODO DE BISECCION');
fprintf('\n\t\t===================');
fprintf('\n\n');
i=1;
fa=feval('fin',ai);
while (i<=n)
pn=ai+(bi-ai)/2;
fp=feval('fin',pn);
if (fa*fp)>0
ai=pn;
elseif (fa*fp)<0
bi=pn;
end
if i==(n-1)
pn1=pn;
end
i=i+1;
end
if fp==0 | ((pn-pn1)/pn)<e
fprintf('\n\t\tP= %.10f',pn);
elseif ((pn-pn1)/pn)>=e
fprintf('\n\t\t=============================');
end
fplot('fin',[-30 30]);
fprintf('\n\nDesea reejecutar(s/n):');
resp=input(' ');
resp=upper(resp);
while(resp~='S'&resp~='N')
fprintf('\n\nreeingresar...(S\N):');
resp=input(' ');
resp=upper(resp);
end
end
METODO DE BISECCIÓN
Aplique el método de bisección en base al programa creado, para encontrar soluciones
exactas dentro de 10^ (-5) para los siguientes problemas.
Ingrese limite 1: 0
Ingrese limite 2: 1
P= 0.6411857445
Ingrese limite 1: 0
Ingrese limite 2: 1
P= 0.2575302854
c.) 2 xcos ( 2 x ) −(x +1)2 para -3 ≤ x ≤ -2
Ingrese limite 1: -3
Ingrese limite 2: -2
P= -2.1913080118
C1.) 2 xcos ( 2 x ) −(x +1)2 para -1 ≤ x ≤ 0
Ingrese limite 1: -1
Ingrese limite 2: 0
P= -0.7981599614
P= 0.2975302337
D’.) xcos ( x )−2 x 2+ 3 x−1 para 1.2 ≤ x ≤ 1.3
P= 1.2566233225