Question
Write a Matlab function to compute the n-degree Taylor polynomial Pn(x) of f(x) = ex (centered at x = 0), where n can be arbitrary.
Write a Matlab function to compute the n-degree Taylor polynomial Pn(x) of f(x) = ex (centered at x = 0), where n can be arbitrary. For the cases n = 4, n = 10, and n = 50, plot Pn(x) and f(x) on the same graph for x in the range 2 x 2. Choose an appropriate step size. Make sure to plot the two functions with different styles (for example, plot one as a line and the other as data points) so that they can be distinguished. You should make a separate plot for each n. Save each plot as a PNG file to be included in your lab report. For each case, also plot the error (absolute value of the difference) against x. So in total, you will have 6 plots
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started