Solve Trigonometric Functions Using MATLAB
Question
Consider the function,

Approximate the first derivative of f(x = 4) using the first order accurate forward difference, second-order accurate central difference, and fourth-order accurate central difference
( f’i = (fi-2 - 8 fi-1 + 8fi+1 – fi+2) / (12h) + O (h4) formulas. Compare the numerical approximation to the exact analytical derivative using grid spacings of h = 1, 0.1, 0.01, 0.001, and 0.0001 by plotting the error (defined as the absolute value of the difference from the exact derivative) versus the grid spacing. Use log-log axes and confirm the order of accuracy of each of the formulas. Comment on your results and explain any potential abnormal behavior (there should be two).
Summary
This question belongs to MATLAB software and discusses about application of MATLAB in mathematics to solve trigonometric functions using the first order accurate forward difference, second-order accurate central difference, and fourth-order accurate central difference formulas.
Answer is in MATLAB format
