Question: Approximate f'(1) for f(x) = cos(x) using a centered difference. In Matlab, create an array called h. Start with h(1) = 0.05. In a while

Approximate f'(1) for f(x) = cos(x) using a centered difference. In Matlab, create an array called h. Start with h(1) = 0.05. In a while loop, decrease the step size by a factor of 2 each time until h(i) is smaller than 10^13 . Build another array in the same loop for the exact error in the approximation. Create a log-log plot of the results with the command: loglog(h,err). The plot should show an h which minimizes the error. From your plot, estimate the optimal h. Turn in this answer along with the plot.

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!