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)$](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f307f606caf_31766f307f584f9e.jpg)
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
Get step-by-step solutions from verified subject matter experts
