Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Correccion de La Parcial de LP
Correccion de La Parcial de LP
PROGRAMACIÓN
INICIO
INGRESAR:
fx, gx, e, n,po
i=0
i<n y
error<e
p=po-
f(po)/g(po)
e=|p-po|
i=i+1
po=p
MOSTAR:
po
FIN
1
x2
є=0.001
f ( x) 2 x
x 5
function puntofijo
clc,clear
f=input('ingrese función:','s');
xi=input('ingrese aproximación inicial:');
e=input('ingrese tolerancia de error:');
disp(' ')
syms x
df=diff(f,x);
if abs(subs(df,1))>1;
disp('la función no converge');
else
disp(' Iteración(Nº) Xi Xi+1 Error');
it=1;
xi2=subs(f,xi);
e0=abs(xi2-xi);
fprintf(' %g %f %f %f\n',it,xi,xi2,e0);
while abs(xi2-xi)>e ;
xi=xi2;
xi2=subs(f,xi2);
it=it+1;
e0=abs(xi2-xi);
fprintf(' %g %f %f %f\n',it,xi,xi2,e0);
end
disp(' ')
disp('se obtuvo por el método en:')
disp(' ')
fprintf('la iteración :%g \n',it);
fprintf('Xi :%f\n',xi);
fprintf('Xi+1(la raiz):%f\n',xi2);
fprintf('con un error :%f\n',e0);
end
ingrese función:(((x^2)+((1/x)^(1/2)))/((x^2)-5))
ingrese aproximación inicial:1
ingrese tolerancia de error:0.001
la iteración :11
Xi :-0.156397
Xi+1(la raiz):-0.155809
con un error :0.000593
x 2 3 9 15 31
Y 7 9 18 23 32
9.02*log(x) – 0.479
function secante
clc,clear
f=input('ingrese función:','s');
xi=input('ingrese aproximación inicial:');
xi1=input('ingrese aproximación siguiente:');
e=input('ingrese tolerancia de error:');
disp(' ')
syms x
df=diff(f,x);
ingrese función:9,02*log(x)-0.479
ingrese aproximación inicial:1
ingrese aproximación siguiente:2
ingrese tolerancia de error:0.001
la iteración :4
Xi-1 :1.250937
Xi :1.271190
Xi+1(la raiz):1.270618
con un error :0.000572
Grafico de la función
10
9.8
9.6
9.4
9.2
8.8
8.6
8.4
8.2
8
2 4 6 8 10 12 14 16 18 20
>> x=2:20;
>> y=(((x.^2)+(3.*x))./((x+2)))+((((3.*x)+5)./(x)).^(1/2));
>> g=((x+3)./(x-1)).*((((x+1).^(1/2))./((x-1).^(1/2))).^(2));
>> subplot(1,2,1), plot(x,y,'r-'), title( 'Grafico No 1' ), grid;
>> subplot(1,2,2), plot(x,g,'mo'), title( 'Grafico No 2' ), grid;
Grafico No 1 Grafico No 2
24 15
22
20
18
10
16
14
12
5
10
4 0
0 5 10 15 20 0 5 10 15 20