Objective: To investigate the approximation of functions by Maclaurin and Taylor series using MatLab In this project we investigate the approximation of fC) sin ()by its Maclaurin series Where n is the sum of the last four digits of your student ID for example if ID 2011 45630 sum will be 5-6+3+0 so on 14 Define your constant n Declare your variable x(as your symbolic variable with matlab) l. Consider the function fo) sin(x) a. Define the function (as inline function with matlab) b. Compute with matlab P3, P5 and Pn the Maclaurin polynomial of f() of degree 3,5 and n respectively. c. Plot fix) with each of those polynomial, noting that as the taylor polynomial with highest degree get closer to the function within the interval of convergence. 2. Consider the function fo) log(x) a. Define the function (as inline function with matlab) b. Compute with matlab T3, T5and Tn theTaylor polynomial of fox) of degree 3,5 and n respectively at 1. c. Plot fix) with each of those polynomial, noting that as the taylor polynomial with highest degree get closer to the function within the interval of convergence. Deadline for submission: 02/06/2017
Expert Answer
n=25;
syms x;
f=inline(sin(x));
P3=taylor(f(x),’Order’,3);
P5=taylor(f(x),’Order’,5);
Pn=taylor(f(x),’Order’,n);
fplot(f(x))
hold on
fplot(P3)
fplot(P5)
fplot(Pn)
legend(‘f(x)’,’P3′,’P5′,’Pn’)
%Pn and f(x) overlap eac other
2.
n=25;
syms x;
f=inline(sin(x));
P3=taylor(f(x),’ExpansionPoint’, 1,’Order’,3);
P5=taylor(f(x),’ExpansionPoint’, 1,’Order’,5);
Pn=taylor(f(x),’ExpansionPoint’, 1,’Order’,n);
fplot(f(x))
hold on
fplot(P3)
fplot(P5)
fplot(Pn)
legend(‘f(x)’,’P3′,’P5′,’Pn’)
%Pn and f(x) overlap eac other