Question: 2. [70 points] Write a Matlab function exp est $(x, D)$ that accepts a scalar $x$ and the number of desired significant digits of accuracy,

 2. [70 points] Write a Matlab function exp est $(x, D)$

2. [70 points] Write a Matlab function exp est $(x, D)$ that accepts a scalar $x$ and the number of desired significant digits of accuracy, $D$, and returns the value, $y$, of the polynomial approximation, $$ e^{x}=1+x+\frac{x^{2}}{2 !}+\frac{x^{3}}{3 !}+\cdots+\frac{x^{n}}{n !}+\cdots $$ and its degree $n$. Your function must be complete with comments and error trapping if needed. It should default to $D=5$, if $D$ is not specified in the function call. Your function should: a) Provide the true absolute relative error pertaining to the estimate b) Generate a dashed green plot of the exact function $f(x)=\cos (x)$, for $-2 \pi \leq x \leq 2 \pi$. c) Show a solid blue plus sign (+) on the same plot indicating the location of the estimated value of $x$. CS.VS. 1136||

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!