Documentos de Académico
Documentos de Profesional
Documentos de Cultura
%Graficas derivadas
subplot(1,3,1)
hold on
set(ezplot(f),'Color','red')
set(ezplot(diff(f,1)),'Color','green')
set(ezplot(diff(f,2)),'Color','blue')
set(ezplot(diff(f,3)),'Color','yellow')
set(ezplot(diff(f,4)),'Color','black')
set(ezplot(diff(f,5)),'Color','cyan')
hold off
grid on
title('Derivadas')
legend('f(x)','1°derivada','2°derivada','3°
derivada','4°derivada','5°derivada')
%Evaluando en un punto x
xa=input('Introduce el valor del punto x: ');
Pe=vpa(subs(P5,xa),6)
%Obtener el error
%Valor real
Vreal=vpa(subs(f,xa),4)
%Error absoluto
EA=vpa(abs(Vreal-Pe),4)
%Error relativo
ER=vpa(EA/Vreal,4)
%Error porcentual
EPR=vpa(ER*100,4)
%Graficando los polinomio de Taylor
subplot(1,3,2)
hold on
set(ezplot(f),'Color','cyan')
set(ezplot(P1),'Color','magent')
set(ezplot(P2),'Color','blue')
set(ezplot(P3),'Color','red')
set(ezplot(P4),'Color','black')
set(ezplot(P5),'Color','green')
hold off
grid on
title('Polinomios de Taylor')
legend('f(x)','1°grado','2°grado','3°grado','4°grado','5°grad
o')
Grafica
Resultados
Introduce el punto a aproximar, a es: 0
1
-----
x+2
P1 =0.5*x + 0.6931
P2 =- 0.125*x^2 + 0.5*x + 0.6931
P3 =0.04167*x^3 - 0.125*x^2 + 0.5*x + 0.6931
P4 =- 0.01562*x^4 + 0.04167*x^3 - 0.125*x^2 + 0.5*x + 0.6931
P5 =0.00625*x^5 - 0.01562*x^4 + 0.04167*x^3 - 0.125*x^2 + 0.5*x + 0.6931
Pe =1.1683
Vreal =1.163
EA =0.005148
ER =0.004426
EPR =0.4426
Ejecución