Question: Using Mathlab! Consider the function f(x) = e^-x^2 sin (x). Estimate the derivative of the function at the point x = 0 using each of

Using Mathlab!
Consider the function f(x) = e^-x^2 sin (x). Estimate the derivative of the function at the point x = 0 using each of the four formulas listed below for all of the following values of h= 10^n, n = 1, 2, ..., 6. f'(x_0 + h) - f(x_0)/h (forward difference) f'(x_0) f(x_0 + h) - f(x_0 - h)/2 h (3-point centered difference) f'(x_0) -f(x_0 + 2h) + 4f(x_0 + h) - 3f(x_0)/2h f'(x_0) -f(x_0 + 2h) + 8f(x_0 + h) - 8f(_0 - h)) + f(x_0 - 2h)/12h Plot your error verses ft for all methods on the same graph. You may have cause to use loglog plot with the commands: loglog loglog(x1, y1, '-k', x2, y2, '-b', x3, y3, '-g', x4, y4, '-m', linewidth', 2); legend ('FD', '3pt CD', '3pt 1SD', '5pt CD'); Explain your findings. Is the error decreasing with ft? Why or why not? Which method has the largest error? Which method has the smallest error? Why
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
