Documentos de Académico
Documentos de Profesional
Documentos de Cultura
1. POLINOMIO DE TAYLOR
% POLINOMIO DE TAYLOR
% Halle el polinomio de Taylor de grado N=4 de la funcion dada por
% F(X)=X^(1/2) alrededor de Xo=0
clc
clear
disp(' Universidad Central del Ecuador');
disp(' Facultad de Ingeniería Química');
disp(' Análisis Numérico');
f=inline(input('f(x):','s'));
x1=input('X(i):');
x2=input('X(i+1):');
n=input('Numero de orden: ');
h=x2 - x1;
v1=f(x1);
v2=f(x2);
et=abs((v2-v1)/v2*100);
X=[0 v1 0 et];
for i=1:n
d=diff(sym(f(x1),i));
v1=v1+(d*((h^i)/factorial(i)));
et=abs(((v2-v1)/v2)*100);
X(i+1,1)=i;
X(i+1,2)=v1;
ea=abs((X(i+1,2)-X(i,2))/X(i,2)*100);
X(i+1,3)=ea;
X(i+1,4)=et;
if ea<=0
break
end
end
% Presentacion de resultados
fprintf('n Valores de X y Y n ');
disp(xa);
disp(ya);
fprintf('n Polinomio interpolacion Newton : %s n\n',acum);
x=input(' X interp = ');
if x>max(xa)|x<min(xa)
fprintf('t Punto fuera de rango. El resultado puede ser equivocado
n:\n');
end
xinterp=x;
yinterp=eval(acum);
fprintf(' Y(%g) = %g n\n',x,yinterp);
% Grafica de los puntos
fprintf(' Pulse cualquier tecla para ver la grafica de los puntos n:');
pause
xg=linspace(min(xa),max(xa));
x=xg;yg=eval(acum);
plot(xg,yg,xa,ya,'.r',xinterp,yinterp,'or');
grid
4. POLINOMIO DE CHEBYSHEV
% POLINOMIO DE CHEBYSHEV
% Halle el polinomio de chebyshev.
xxx=0;
k2=[1:n];
for kk8=1:length(k2)
xxx(kk8)=cos((kk8-1/2)*pi/n);
end
ftx=zeros(n,n+1);
for kk9=1:n
ftx1=ones(1,n+1);
ftx2=[n:-1:0];
ftx3=ftx1*xxx(kk9);
ftx4=ftx3.^ftx2;
ftx(kk9,:)=[ftx4];
end
ifwxt=0;
for kk10=1:n
ifa1=tnx;
ifa2=ftx(kk10,:);
ifa3=ifa1.*ifa2;
ifa4=sum(ifa3);
ifa5=pi/n*ifa4;
ifwxt=ifwxt+ifa5;
end
ifwxt