Question: Need Help writing this Matlab code please provide comments so I can understand. thank you 1. Consider the function f (z) = (12-3z +2) arctan
Need Help writing this Matlab code please provide comments so I can understand. thank you

1. Consider the function f (z) = (12-3z +2) arctan x. Estimate the derivative of the function at the point 0 using each of the three formulas listed below for all of the following values of h: h10" n 1,3,6. Make a loglog plot of your error verses h (use the same plot for both methods). f(ro + h) - f(ro) (forward difference) (3 pt centered difference) (5 pt centered difference) 2h f(o) 12 For n- 1,3, 6 call FD1, FD3, FD6 the result obtain with the forward difference, CD31, CD33, CD36 the result obtain with the 3 point centered difference, and CD51, CD53, CD56 the result obtain with the 5 point centered difference. Plot your error for all three methods on the same graph. Explain your findings. Is the error decreasing with h? Why or why not? Which method has the largest error? Which method has the smallest error? Why? Write those answers in comment using %. 1. Consider the function f (z) = (12-3z +2) arctan x. Estimate the derivative of the function at the point 0 using each of the three formulas listed below for all of the following values of h: h10" n 1,3,6. Make a loglog plot of your error verses h (use the same plot for both methods). f(ro + h) - f(ro) (forward difference) (3 pt centered difference) (5 pt centered difference) 2h f(o) 12 For n- 1,3, 6 call FD1, FD3, FD6 the result obtain with the forward difference, CD31, CD33, CD36 the result obtain with the 3 point centered difference, and CD51, CD53, CD56 the result obtain with the 5 point centered difference. Plot your error for all three methods on the same graph. Explain your findings. Is the error decreasing with h? Why or why not? Which method has the largest error? Which method has the smallest error? Why? Write those answers in comment using %
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
